Skip to content

Instantly share code, notes, and snippets.

@sleiner
Last active July 31, 2020 07:52
Show Gist options
  • Save sleiner/3cf61abe32df02a36eb1dc9c896ddd3c to your computer and use it in GitHub Desktop.
Save sleiner/3cf61abe32df02a36eb1dc9c896ddd3c to your computer and use it in GitHub Desktop.
Testing for GCC compile-time constants quickly
/* Tests compile constants in GCC */
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#if defined(__STDC_VERSION__)
#pragma message STR(__STDC_VERSION__)
#else
#pragma message "__STDC_VERSION__ not defined"
#endif
#if defined(__STRICT_ANSI__)
#pragma message STR(__STRICT_ANSI__)
#else
#pragma message "__STRICT_ANSI__ not defined"
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment