Sample code snippet
const const const int x = 10;
int main()
{}
gets compiled in C but not in C++. Why does it get compiled in C? I thought this would fail in C as well. Never mind.
Which part of the C++ Standard forbids the use of duplicate const and which part of the C standard allows this?
C99 ยง6.7.3/4:
If the same qualifier appears more than once in the same specifier-qualifier-list, either directly or via one or more typedef s, the behavior is the same as if it appeared only once.
Yes, that is valid C99, and your discovery is correct.