To my surprise this code compiles with gcc 11.4.0 and i
becomes 0:
#include <stdio.h>
int main( int argc, char *argv[] )
{
int i = 1i;
printf( "i = %dn", i );
return 0;
}
I tried googling for the suffix i
but without success. In every description I’ve found only the usual ones are mentioned (e.g. in the answers to that SO question)
I’ve also tried with all lower characters and other integer values and found that it’s the same behaviour with j
ant the value of my variable was always 0
. With other suffixes like a, b … it wouldn’t compile.
So what is it that I’ve been stumbled upon? And is there a way to prevent gcc from compiling that or at least have some kind of diagnostics? In the ‘real world source’ this happened because of a simple typo and of course resulted in run time errors