This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: Achieving C99 compliance via C++
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
I thought it was a well understood joke that achieving C99 compliance requires a C++ compiler. A recent entry on reddit (which I can't find right off hand) bemoaned the fact that with Visual C++ you can't compile this because of the inline type declaration:
// for.c
#include <stdio.h>
int main(){
for(int i = 0; i < 10; i++)
printf("I is: %i\n", i);
return 0;
}
With a standard C compiler (including gcc 3, by the way), this will fail to compile. So, how do we make it work? By passing the -Tp switch, which builds your program using C++ instead of C: