On Thu, Feb 11, 2010 at 8:00 PM, Dennis Clarke <dclarke@xxxxxxxxxxxxx> wrote: > >> On Thu, Feb 11, 2010 at 7:40 PM, Dennis Clarke <dclarke@xxxxxxxxxxxxx> >> wrote: >>> >>>> It all reminds me a story when I won a bottle of beer from my >>>> scientific adviser back in 2005. We had a bet: will gcc compile this >>>> code: >>>> #include <stdio.h> >>>> int main() { >>>> printf("a"); >>>> int a; >>>> printf("b"); >>>> return 0; >>>> } >>>> He was so sure that gcc won't allow it that didn't ever tried :) Thus, >>>> I think gnu extensions by default are not so bad :) >>>> >>>> Alexey >>> >>> Let's have a look at that. I don't see any issues really. You call >>> printf() with a literal string, then define some simple integer, then >>> print another literal string with a call to printf() and finally return >>> back to the calling process with a status of 0. Very nice. >>> > <snip> >> >> 334 lines of research for 7 lines of code :) >> >> Alexey > > Here are 7 more :-) > > $ lint -v -Nlevel=4 -Xc99=all sample1.c > > variable unused in function > (9) a in main > > function returns value which is always ignored > printf > > > -- > Dennis Clarke > dclarke@xxxxxxxxxxxxxx <- Email related to the open source Solaris > dclarke@xxxxxxxxxxxxx <- Email related to open source for Solaris > > > What for? If you read my messages carefully you'll understand that I know it works with gcc perfectly. Actually I've won a bottle of beer due to that knowledge :) But try to compile that code with MSVS for instance (or try reading C89 standard) and you'll see why it was possible that it would NOT work. Alexey