Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Ok,


C++
#ifdef _DEBUG

SuperSecretVariable = 0;

#endif


Will SuperSecretVariable = 0; exist in any way in the release build assuming _DEBUG is not defined in the release configuration? Or in other words is it the equivalent of commented-out code?

Thanks.

:Mor-Ron
Posted

#ifdef is a preprocessor directive - which means it is processed before your source code is passed to the actual compiler, and the #if (and all other #directives) are handled then and there and the substitutions made in the source at that point.
So if the test fails, the code is never passed anywhere and thus can't appear in the final output in any form.
 
Share this answer
 
Comments
Ron Anders 1-Nov-13 18:53pm    
That's what I thought but in this instance I had to be certain.

Excellent.

Thank you all and have a super weekend.
the answers you seek are no, and yes

(assuming there's no other place you've defined 'SuperSecretVariable' )

'g'
 
Share this answer
 
Comments
Ron Anders 1-Nov-13 18:41pm    
Thanks. I realize that.

Carry on all. :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900