Original Post
I want an if statement that will occur only if I compile my program in debug configuration and wont occur if I compile in release configuration. How do I achieve that?
Quote:
Original post by haegarr
In principal I agree w/ nmi, but I've read somewhere that MSC uses _DEBUG instead of DEBUG. So there may be little variations in dependence of the compiler in use. (E.g. gcc uses DEBUG). For portability it would be best to unify these stuff in a prerequisites header file if possible.
Quote:
Original post by haegarr
However, it seems senseful to me to couple the inclusion/exclusion of the if clause as is requested in the original posting to the standard flags, instead of overhanding an own flag (what of course also can make sense). So I've suggested a prerequisites header file to overcome protability problems by unifying the possible "standard" compiler flags to one to be used throughout the sources.
Quote:
Original post by joanusdmentia
You more often than not start loading it with all sorts of things that really shouldn't be there and makes your code dependant on an essentially unrelated header.
Quote:
Original post by joanusdmentia
Not only that, but your prerequisites file needs to try and account for all the different 'standard' defines for different compilers to try and guess if you're running a debug build or not (admittadly there's prob only the 2 variations). It's far simpler to just say 'define this in your project for debug builds'.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more