Preprocessor directives checking
Posted: 20 Dec 2014, 19:59
This is a very specific question about the game code. More like a doubt actually.
In the case of, for example, the main.cpp file, we can see the following directives all over the code:
Wouldn't the following be "equivalent"? Or are we aiming to avoid conditional statements at runtime?:
- At the program head:
- In the middle of the code:
It is not like this is important at all. I'm just watching it from the readibility perspective.
In the case of, for example, the main.cpp file, we can see the following directives all over the code:
Code: Select all
#ifdef DEBUG
debug() ...
#endif
- At the program head:
Code: Select all
#ifdef DEBUG
bool debug = true;
#else
bool debug = false;
#endif
Code: Select all
if(debug){
debug() ...
}