Compiler Directives

Louis

Active Member
Licensed User
Longtime User
Is there any possibility of adding compiler directives to compile certain statements if a MACRO type definition is defined? E.G. like in C:
#define num 1
#if num
// Compile This Code
#else
Compile This Code
#endif

It would help for projects that have debugging statements throughout the program, and if a symbol is not defined, (or macro) then the statements are NOT compiled. What do you think?
 

Cableguy

Expert
Licensed User
Longtime User
That would render tha code a bit too complex for us who DON'T know C....
 

Louis

Active Member
Licensed User
Longtime User
Hi. It could somehow be implemented, not like C, but in such a way that we could have code compiled based on optional conditions. E.G. Let's say I have a program with some debug code, and I want this code removed before building the release executable. Rather than look through the code for all debug statements, if a variable, one that I choose, isn't defined then code in between the special conditional statements won't be included in the program. This will make executables faster as the program won't have to check if a variable is set to true or false at runtime, but instead it checks the conditions at compiletime, thus excluding any code when compile conditions are false. Make sense anyone?
 

Cableguy

Expert
Licensed User
Longtime User
you mean like a [debug] some debug coding [/debug] tagging?
????
That would be good...
 

Louis

Active Member
Licensed User
Longtime User
Exactly, But people could use it to have code included or excluded for various reasons, not just for compiling. HTH.
 
Top