Using #ifdef
s, or your language's equivalent, is a common occurrence in code, not only when writing cross-platform code. #ifdef
s (or #if
in C#, Swift and Iodine and {$IF}
in Oxygene), let you conditionally compile different parts of your project — for example to account for APIs not available on all platforms, or for code you want to run only in debug or in release mode.
This is a companion discussion topic for the original entry at https://blogs.remobjects.com/2017/12/21/ifdef-redefined/