I have never worked with #if, #ifdef, #ifndef, #else, #elif and #endif.
As I was going through some source-codes, I found an extensive use of these directives. Did some reading on conditional-preprocessors but found no clue like how are they different from normal conditional statements. So I was wondering what is the advantage of following code:
#include<iostream>
int main()
{
int i = 0;
#if i == 0
std::cout<<"This";
#else
std::cout<<"That";
#endif
return 0;
}
over this:
#include<iostream>
int main()
{
int i = 0;
if (i == 0)
std::cout<<"This";
else
std::cout<<"That";
return 0;
}
Also, when to-use/not-to-use conditional-preprocessor?