I found the following snippet (I think in Wikipedia) that creates a different run-time when C++ comments are recognized than when not:
int a = 4 //* This is a comment, but where does it end? */ 2
;
But until now that's been the only one (variants excluded).
I'm not interested in differentiating using __STDC__
and the like, and not in programs that C89 will not compile.
Are there other programs/snippets producing a different run-time with C89 than C99?
This program will print 0.000000
on a conforming C89 implementation and 1.000000
on a conforming C99 implementation:
#include <stdio.h>
#include <stdlib.h>
int main()
{
double d = strtod("0x1", NULL);
printf("%f\n", d);
return 0;
}