IT Community - Software Programming, Web Development and Technical Support

Visual C++ Tips & Tricks

This is a discussion on Visual C++ Tips & Tricks within the C and C++ Programming forums, part of the Software Development category; Thanks for providing the useful informations. _______________ uk adverse credit re mortgage irvine Lexus cheap web hosting web design Australia...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #81 (permalink)  
Old 10-31-2008, 10:49 AM
subho subho is offline
D-Web Trainee
 
Join Date: Oct 2008
Posts: 15
subho is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Thanks for providing the useful informations.

_______________
uk adverse credit re mortgage irvine Lexus cheap web hosting web design Australia
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #82 (permalink)  
Old 11-22-2008, 06:47 AM
Cathrine Cathrine is offline
D-Web Trainee
 
Join Date: Nov 2008
Posts: 4
Cathrine is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Hey Guys!! I am newbie though not a techie the tip was very useful for my bro . Thnks a ton . Keep posting good ones ....


Regards

Cathrine

Houston Storage

Houston Mini Storage

Houston Texas Storage

Houston Storage - Mini Self Storage Units in Houston Texas
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #83 (permalink)  
Old 12-19-2008, 05:28 AM
sara_criss sara_criss is offline
D-Web Trainee
 
Join Date: Dec 2008
Posts: 8
sara_criss is on a distinguished road
Default Re: Visual C++ Tips & Tricks

thnx a lot for this tutorial ....i am really getting a lot from here ......
__________________
Sticker Printing
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #84 (permalink)  
Old 12-22-2008, 08:24 PM
harshley harshley is offline
D-Web Trainee
 
Join Date: Dec 2008
Posts: 5
harshley is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Find corresponding brackets

Position the cursor over any "{", "[", "(", "}", "]" or ")" bracket and hit CTRL+"]". The cursor will move to the corresponding opening/closing bracket of that expression.
__________________
harshley

Lasik Information
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #85 (permalink)  
Old 01-06-2009, 02:01 AM
harshley harshley is offline
D-Web Trainee
 
Join Date: Dec 2008
Posts: 5
harshley is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Count BPs
Stop on the Nth iteration
To Help find N:
Set BP w/ very large count (C==10000)
Run until your app crashes
Look at count value (X)
Set count BP on C-X-1
By Name
Stays put through edits (as opposed to F9, for
file/line number BPs)
Memory Leaks
Docs are confusing
Indexed entries talk about MFC
No clear description
Go to "Visual C++ Documentation/Using Visual C++/Visual
C++ Programmers Guide/Debugging/Debugging
Techniques.Problems and Solutions/Solving Buffer
Overwrites and Memory Leaks" (6.0)
Include order is important
Some things redefine malloc and free, etc.
Step 1, include in global header file
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
Step 2, enable checks in WinMain:
// Enables tracking and reporting on shutdown.
_CrtSetDbgFlag (
_CRTDBG_ALLOC_MEM_DF |
_CRTDBG_LEAK_CHECK_DF);
_CrtSetReportMode ( _CRT_ERROR,
_CRTDBG_MODE_DEBUG);

It may list file/line number
Will list leak number
set {,,msvcrtd.dll}_crtBreakAlloc = n (leak number)
Or, look for ASCII clues.
Memory Corruption
Heap Corruption
Enable heap checking (slow)
{,,msvcrtd.dll}_crtDbgFlag = 5
Data BPs may be useful
Optimized Code
It's hard
Compile with /Zi
Variables vanish or are wrong
Use disassembly window for truth
Arguments usually OK except
this
fastcall
Just find your bugs in Debug! 8)
Casting in the debugger
Need correct type name
Debugger doesn't know typedefs
To find the true typename,
Add variable to watch, RClick, choose properties
Scoping:
variable defined in current DLL, type defined in another
DLL:
{,,foo.dll}(CMyClass *){*}pObject
pObject is local, CMyClass defined in foo.dll
Modules Window
Debug.Modules
Sort by:
Module name
Address range
Useful for finding out what module you're in
Find DLL of EIP
Full path
Ensure you're using the correct DLL
Load order (default)
__________________
harshley

Lasik Information
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #86 (permalink)  
Old 01-06-2009, 06:58 PM
harshley harshley is offline
D-Web Trainee
 
Join Date: Dec 2008
Posts: 5
harshley is on a distinguished road
Default Re: Visual C++ Tips & Tricks

// Statements like:
// #pragma message(Reminder "Fix this problem!")
// Which will cause messages like:
// C:\Source\Project\main.cpp(47): Reminder: Fix this problem!
// to show up during compiles. Note that you can NOT use the
// words "error" or "warning" in your reminders, since it will
// make the IDE think it should abort execution. You can double
// click on these messages and jump to the line in question.
#define Stringize( L ) #L
#define MakeString( M, L ) M(L)
#define $Line \
MakeString( Stringize, __LINE__ )
#define Reminder \
__FILE__ "(" $Line ") : Reminder: "
__________________
harshley

Lasik Information
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #87 (permalink)  
Old 01-06-2009, 07:26 PM
harshley harshley is offline
D-Web Trainee
 
Join Date: Dec 2008
Posts: 5
harshley is on a distinguished road
Default Re: Visual C++ Tips & Tricks

// Statements like:
// #pragma message(Reminder "Fix this problem!")
// Which will cause messages like:
// C:\Source\Project\main.cpp(47): Reminder: Fix this problem!
// to show up during compiles. Note that you can NOT use the
// words "error" or "warning" in your reminders, since it will
// make the IDE think it should abort execution. You can double
// click on these messages and jump to the line in question.
#define Stringize( L ) #L
#define MakeString( M, L ) M(L)
#define $Line \
MakeString( Stringize, __LINE__ )
#define Reminder \
__FILE__ "(" $Line ") : Reminder: "
Once defined, use like so:

#pragma message(Reminder "Fix this problem!")
This will create output like:

C:\Source\Project\main.cpp(47): Reminder: Fix this problem!
__________________
harshley

Lasik Information
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/c-c-programming/531-visual-c-tips-tricks.html
Posted By For Type Date
Microsoft Visual C - encyclopedia article about Microsoft Visual C. This thread Refback 02-25-2008 10:03 AM
Vc++ - encyclopedia article about Vc++. This thread Refback 11-13-2007 11:43 PM
Investment Calculator - calculator weight, broker calculator investment This thread Refback 09-06-2007 05:51 PM
Web Link This thread Refback 09-05-2007 09:14 PM
Visual C++ Tips & Tricks - DiscussWeb IT Community - Technical Support and Technology Discussions Post #12 Refback 08-25-2007 06:06 PM
VC++ Tips & Tricks - DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 08-17-2007 05:57 PM
Digg / Programming / Upcoming This thread Refback 07-19-2007 09:51 AM
digg / vinothchandar / news / dugg This thread Refback 07-19-2007 08:55 AM
Digg / Technology / Upcoming This thread Refback 07-19-2007 08:36 AM
VC++ Tips & Tricks - Discussweb IT Community - Web Development, Software Programming, SEO, Quality Assurance, 3D, Web Hosting and more... This thread Refback 07-11-2007 11:55 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
C# .Net Tips & Tricks oxygen C# Programming 84 12-02-2008 02:12 AM
SAP Tips & Tricks leoraja8 Operating Systems 0 03-29-2008 01:11 AM
Visual Studio Tips & Tricks SaravananJ C# Programming 197 12-20-2007 04:25 AM
.NET tricks & Tips Karpagarajan VB.NET Programming 1 04-23-2007 09:17 AM
SEO Tips & Tricks spid4r Search Engine Optimization 0 03-09-2007 12:03 AM


All times are GMT -7. The time now is 05:39 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0