I ran my #ifdef counter on the Rotor sources. The #ifdefs fall into a few categories:
By far, most #defines were only used once (often as #pragma once alternatives).
I wonder how many other software projects have similar distributions. I think it's interesting to consider how these could be reduced.#1 (cross-platform/OS, compiler) could certainly be reduced by programming at a higher abstraction level. Using C/C++ as a shortcut for assembly language tends to produce a lot of #ifdef usage like this. #2 (#pragma once) is purely a consequence of the C preprocessor's design choices. Other languages (like C#) don't even have this.#4 (Features) is ideally solved by better componentization and better design abstractions.
Here were the top usages:
2249 _DEBUG1266 DACCESS_COMPILE389 _X86_302 _MSC_VER220 DECLARE_HELPERS133 DEBUGGING_SUPPORTED125 PROFILING_SUPPORTED118 PLATFORM_UNIX98 LOGGING89 _PPC_78 _DEBUG_IMPL75 CHECK_APP_DOMAIN_LEAKS74 __cplusplus71 BIGENDIAN59 _WIN64