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....


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, 09:49 AM
subho subho is offline
D-Web Trainee
 
Join Date: Oct 2008
Posts: 13
subho is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Thanks for providing the useful informations.

Last edited by arjkhanna : 06-29-2009 at 08:31 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #82 (permalink)  
Old 11-22-2008, 05: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

Last edited by arjkhanna : 06-29-2009 at 08:33 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #83 (permalink)  
Old 12-19-2008, 04: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 ......
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #84 (permalink)  
Old 12-22-2008, 07: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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #85 (permalink)  
Old 01-06-2009, 01: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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #86 (permalink)  
Old 01-06-2009, 05: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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #87 (permalink)  
Old 01-06-2009, 06: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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #88 (permalink)  
Old 02-03-2009, 01:34 AM
Sam100 Sam100 is offline
D-Web Trainee
 
Join Date: Feb 2009
Location: Los Angeles, CA
Posts: 6
Sam100 is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Some great tips are here. Thanks for sharing!
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #89 (permalink)  
Old 04-29-2009, 01:40 PM
Bernadette Bernadette is offline
D-Web Trainee
 
Join Date: Apr 2009
Posts: 8
Bernadette is on a distinguished road
Default Re: Visual C++ Tips & Tricks

I know how to program in Turbo C++ but never used the knowledge, so now i need to review and re-study so i can go back in programming world. The tips and tricks that you have shared is very helpful to me. Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #90 (permalink)  
Old 06-04-2009, 06:48 AM
IBoxD IBoxD is offline
D-Web Trainee
 
Join Date: Jun 2009
Posts: 1
IBoxD is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Very nice post. I'd been looking for site that i can gather information about Cand C++ programming because i want to update my knowledge in the language.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #91 (permalink)  
Old 06-09-2009, 03:56 PM
certificationmix certificationmix is offline
D-Web Trainee
 
Join Date: Apr 2009
Posts: 7
certificationmix is on a distinguished road
Default Re: Visual C++ Tips & Tricks

Thanks for the codes, but I can really fell headache when I use to read code. lol
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #92 (permalink)  
Old 06-29-2009, 12:46 PM
adam adam is offline
D-Web Trainee
 
Join Date: May 2009
Posts: 6
adam is on a distinguished road
Default Re: Visual C++ Tips & Tricks

I learned C language when i was still in college but sadly never used my knowledge in programming for a long time. So, right now i am refreshing my knowledge about it and your tips well help me a lot.
__________________
weight loss pills
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 09:03 AM
Vc++ - encyclopedia article about Vc++. This thread Refback 11-13-2007 10:43 PM
Investment Calculator - calculator weight, broker calculator investment This thread Refback 09-06-2007 04:51 PM
Web Link This thread Refback 09-05-2007 08:14 PM
Visual C++ Tips & Tricks - DiscussWeb IT Community - Technical Support and Technology Discussions Post #12 Refback 08-25-2007 05:06 PM
VC++ Tips & Tricks - DiscussWeb IT Community - Technical Support and Technology Discussions This thread Refback 08-17-2007 04:57 PM
Digg / Programming / Upcoming This thread Refback 07-19-2007 08:51 AM
digg / vinothchandar / news / dugg This thread Refback 07-19-2007 07:55 AM
Digg / Technology / Upcoming This thread Refback 07-19-2007 07: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 10:55 AM

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


All times are GMT -7. The time now is 03:35 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
Miami FL Divorce Lawyers      Pittsburgh Personal Injury Law      Austin TX Auto Accident Lawyer
Sedo - Buy and Sell Domain Names and Websites project info: discussweb.com Statistics for project discussweb.com etracker® web controlling instead of log file analysis

SEO by vBSEO 3.0.0