An Untold Saga

A simple but useful Coding tip

Posted by: ojasvirajpal on: November 10, 2009

I discovered this while doing CR for a team mate and now I use it almost always. Though it might not be new for the “pro’s” :P but I like it so here it is in the form of a advertisement ;)
Do u always insert a lot of print statements in your code , which might not be useful output ?
Do u use a lot of print statements while debugging ?
Do u find yourself commenting/deleting those printfs after the code is done and reading them when required again ?
Fear no more enjoy the new -debug option !!!
All u need to do is to check for -debug in the command line options and if its there u print all your print statements (use if(debug){} ) else u don’t :D :D :D nice ain’t it ;)
adieu

Advertisement

6 Responses to "A simple but useful Coding tip"

dude, making one’s own “-debug” option is extra work… :(
A truth that will never change: Debugging is always a pain in the ass, be it in a code or in a draft…
Oya Sumi nasai. :)

dude, suggest people to use Visual Studio instead of this :P
1. Better option
2. It’s an MS product :)

Another way that I found is used more frequent is

#ifdef DEBUG
printf(“Something…\n”);
#endif

you can define the symbol while compiling using /DDEBUG (Define DEBUG) while building for debug and without that while building in general :P

@abhishek I agree
@manish Good idea but I am having trouble setting environment variables in Vs any tips ?
@vivek goodidea but u need to recompile, but yes u avoid processing command line arguments.

Wow I mean wow..what a tip.

HCG Levels in Early Pregnancy Thanks for writing this, it was very handy and helped me quite a bit…

Thanks for writing this, it was very handy and helped me quite a bit…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

" Cause I am a fighter Adrian that's the way I am made " . .
"Remember where you came from and what it took to get you here" . .
"You cannot be lonely if you like the person you're alone with."

Categories

Blog Stats

  • 26,722 hits
website counter website counter
Follow

Get every new post delivered to your Inbox.