what is the difference between if and #if. when to use what?
thanks in advance
what is the difference between if and #if. when to use what?
thanks in advance
#if is done before the compiler sees the code, so it has to be a constant known before you even start compiling the code. This is typically selecting different variants of the same code (e.g. #if WINDOWS ... #elsif LINUX ... #else ... ).
if is done during the runtime of the application, so it can do "anything" [although if you write something like if(x) and the compiler can know FOR SURE that x will always be non-zero, it may of course skip the test of x, and always execute the code anyways].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.