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...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Thanks for providing the useful informations. _______________ uk adverse credit re mortgage irvine Lexus cheap web hosting web design Australia |
| Sponsored Links |
| |||
| 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 |
| |||
| thnx a lot for this tutorial ....i am really getting a lot from here ......
__________________ Sticker Printing |
| |||
| 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. |
| |||
| 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) |
| |||
| // 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: " |
| |||
| // 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! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |