Empirically, GCC 14.1.0 still prints the placeholder version number 202000
when compiling with -std=c23
or -std=iso9899:2024
:
#include <stdio.h>
int main(void)
{
printf("__STDC_VERSION__ = %ld\n", __STDC_VERSION__);
return 0;
}
Compiling and executing:
$ gcc --version
gcc (GCC) 14.1.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -O cv67.c -o cv67 && cv67
__STDC_VERSION__ = 201710
$ gcc -O -std=c23 cv67.c -o cv67 && cv67
__STDC_VERSION__ = 202000
$ gcc -O -Wall -Werror -Wextra -std=iso9899:2024 cv67.c -o cv67 && cv67
__STDC_VERSION__ = 202000
$ gcc -O -Wall -Werror -Wextra -std=iso9899:2011 cv67.c -o cv67 && cv67
__STDC_VERSION__ = 201112
$ gcc -O -Wall -Werror -Wextra -std=iso9899:1999 cv67.c -o cv67 && cv67
__STDC_VERSION__ = 199901
$ gcc -O -Wall -Werror -Wextra -std=iso9899:199409 cv67.c -o cv67 && cv67
__STDC_VERSION__ = 199409
$ gcc -O -Wall -Werror -Wextra -std=iso9899:1990 cv67.c -o cv67 && cv67
cv67.c: In function ‘main’:
cv67.c:4:40: error: ‘__STDC_VERSION__’ undeclared (first use in this function)
4 | printf("__STDC_VERSION__ = %ld\n", __STDC_VERSION__);
| ^~~~~~~~~~~~~~~~
cv67.c:4:40: note: each undeclared identifier is reported only once for each function it appears in
$
So GCC 14.1.0 defaults to C17/C18, and uses __STDC_VERSION__ == 202000
for C23.