3 ms·
Oh, please let's not this go into another "compile time" flag, because I've seen enough where this goes. Unless you are doing strictly embedded, or whatever cle
by malkia 3y ago
Oh, please let's not this go into another "compile time" flag, because I've seen enough where this goes. Unless you are doing strictly embedded, or whatever clearance software, you don't need this "compile time" thing.
(I'm speaking from experience, having and still having to deal with tons of #ifdef code - gamedev, great for shipping to a console, awful for the rest of the code - game tools).
- deleted 3y ago[deleted]
- kazinator 3y agoYou can have it both ways! #ifdef FOO_BUILD_TIME_FLAGS #define foo_enabled(CTX, FLAG) ((FOO_BUILD_TIME_FLAGS & (FLAG)) != 0) #else #define foo_enabled(CTX, FLAG) (((CTX)->flags & (FLAG)) != 0) #endif If we specify FOO_BUILD_TIME_FLAGS symbol which expands to a bitwise OR or various flags (or maybe just zero!) then the flag checks in the code all become constant expressions, subject to dead code elimination. If we don't specify that, then there is a flags field that is checked at run-time. I'd rather have most of the flags go away. Pick a behavior and hard-coded. Those who want it some other way can UTSL: use the source, Luke. If you have 8 flags, that's 256 combinations to test for interactions.