I came across a C code that used a compilation directive in #ifdef
and I do not quite understand what it's for. I found an explanation, but it was not clear. Here's an example policy and the explanation I looked for:
#ifdef <token>
/* code */
#else
/* code to include if the token is not defined */
#endif
ifdef checks whether the given token has been #defined earlier in the file or in an included file. If so, it includes everything between it and the closing #else or, if no #else is present, the closing #endif. ifdef can be used with built-in token identifiers set by the compiler to indicate that additional functionality is available.
ifdef checks if the token has been previously assigned through define in the file or even in the same. If yes, include everything in #else or, if #else is not present, #endif. ifdef can be used with the identifiers of built-in token defined by the compiler to indicate the availability of functionalities additional.
Source: link
After all, what are the build directives for? When should I use them? In practice, why are they used?