-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Labels
Description
Currently, the allow_constexpr option is available in C++ mode but not in C mode. The constexpr specifier is also available in C since C23.12 So I think it would be better if this option is available in C mode as well. Because this can be typed, unlike the #define directive.
#include <stdio.h>
#define FOO 10
int main(void) {
printf("%d\n", FOO);
return 0;
}In C23 this code can be written as:
#include <stdio.h>
constexpr int FOO = 10;
int main(void) {
printf("%d\n", FOO);
return 0;
}Footnotes
-
Note that this is not available for functions, unlike C++. ↩