Skip to content

Instantly share code, notes, and snippets.

@cdcme
Created July 3, 2020 13:47
Show Gist options
  • Save cdcme/0b74b860b52c6b03a8f8d81a384058a5 to your computer and use it in GitHub Desktop.
Save cdcme/0b74b860b52c6b03a8f8d81a384058a5 to your computer and use it in GitHub Desktop.
Print out C development environment info
// prints local development environment information
void environs() {
#ifdef __clang_major__
printf ("clang detected version %d.%d\n", __clang_major__, __clang_minor__);
#endif
#ifdef __GNUC__
// note that clang 3.7 declares itself as a gcc 4.2"
printf ("gcc detected version %d.%d\n", __GNUC__, __GNUC_MINOR__);
#endif
#if __STDC_VERSION__ >= 201710L
printf("We are using C18!\n");
#elif __STDC_VERSION__ >= 201112L
printf("We are using C11!\n");
#elif __STDC_VERSION__ >= 199901L
printf("We are using C99!\n");
#else
printf("We are using C89/C90!\n");
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment