C Programming • C17 baseline, standards-specific features labeled
C Standards, Compiler Modes, and Portability
Target a declared C standard and separate portable language features from compiler extensions.
C has multiple published revisions, and compiler defaults differ. A project should name its target standard, enable warnings, and isolate extensions behind documented portability layers. This course uses C17 for its baseline, with separate chapters for C11 facilities and C23 features.
Example
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
#define PROJECT_HAS_C23 1
#else
#define PROJECT_HAS_C23 0
#endif
int project_has_c23_features(void) {
return PROJECT_HAS_C23;
}
What to expect
The compile-time macro lets code select a path only when the compiler advertises the expected C23 version.
Key idea: Test the supported compilers and standard modes that your project actually promises to users.