I was just wandering about whether the values such as GLOBAL_H defined at start of headers is actually included in the memory of the compiled app or not.
Yes, this means that every reference to GLOBAL_H in your code is simply replaced with it's value by the preprocessor before the compiler runs. So the following code
1 2 3 4 5 6
#define VALUE 5
int main()
{
cout << VALUE << endl;
}
would effectively be turned into
1 2 3 4
int main()
{
cout << 5 << endl;
}
That said, the value 5 itself must be stored somewhere in the program. So, in summary:
1) GLOBAL_H is not stored in memory like a variable, it is substituted for its value at compile time
2) The value of GLOBAL_H, if used in the program will become part of the program, in the same way that all constants (integer, string literal, etc) in your program will.
To be clear, it all depends on how you use the preprocessor symbol.
In the example you gave using GLOBAL_H, that naming convention is usually used to provide a guard symbol to prevent a header file from being included multiple times.
In this case, GLOBAL_H is only known to the compiler, and should the header file get included a second time, its contents would be skipped. As stated earlier, no storage would be allocated in the program for GLOBALS_H.
You can use expressions with #if as long as the preprocessor symbols are constants.