Funny if only marginally related fact: even though neither the C++11 syntax
if (int x = foo(); x) { ... }
nor the C++98 syntax
if (int x = foo()) { ... }
is supported in C99, it still introduces the rule that the entire if statement is a scope (which it wasn’t in C89). So as a party trick, here’s a way to check for C99 without using the preprocessor:
This is very cool, although a more compact way to check for single line comments (introduced in C99) versus division using "//* */". I used that trick here:
You gave an IOCCC snippet as an example of a C99 coding trick you know? I mean, the code looks visually cool, but it's funny to explain a code concept using code shaped like an anime character. (At least that's what I think it is.)
Pretty sure that means that tcc at least believes it is a C99 (or later) compiler; if it conformed to an earlier spec it (probably?) would have considered the inner `enum { C99 = 0 }` definition to be still in scope, and the return value would be 0.
That’s correct. I did check before posting that TCC 0.9.27 on Godbolt returned zero here, but I didn’t look beyond that. Evidently things have changed since that release.