Last active
August 29, 2015 14:05
-
-
Save ashelly/6091bf05f4382cd30d9a to your computer and use it in GitHub Desktop.
Method of easily selecting from multitude of exclusive compile time options.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//set only one of the following to 1. | |
#define OPTION_PRIMARY 1 | |
#define OPTION_ALTERNATE 0 | |
#define OPTION_UNLIKELY 0 | |
//Did you follow the rules? | |
#if ((OPTION_PRIMARY+OPTION_ALTERNATE+OPTION_UNLIKELY)!=1) | |
#error("Error configuring options") | |
#endif | |
/*...*/ | |
#if OPTION_PRIMARY | |
printf("primary"); | |
#elif OPTION_SECONDARY | |
puts("secondary"); | |
#elif OPTION_UNLIKELY | |
putc('U'); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment