Skip to content

Instantly share code, notes, and snippets.

@mdznr
mdznr / ConditionallyAssignValueUsingCPreprocessorMacros.c
Last active August 29, 2015 13:56
Wondering if there's a better way to set a value conditionally using C pre-processor macros.
// Is there a better way to do this?:
static int someIntegerValue =
#ifdef SOME_MACRO
4
#else
2
#endif
;
// Or even this?: