From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10808 invoked by alias); 11 Feb 2010 14:14:04 -0000 Received: (qmail 10795 invoked by uid 22791); 11 Feb 2010 14:14:03 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-fx0-f218.google.com (HELO mail-fx0-f218.google.com) (209.85.220.218) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Feb 2010 14:13:59 +0000 Received: by fxm10 with SMTP id 10so1205778fxm.29 for ; Thu, 11 Feb 2010 06:13:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.239.159.203 with SMTP id z11mr207190hbc.183.1265897637107; Thu, 11 Feb 2010 06:13:57 -0800 (PST) In-Reply-To: <52552.10.0.66.17.1265896832.squirrel@interact.purplecow.org> References: <52552.10.0.66.17.1265896832.squirrel@interact.purplecow.org> From: Alexey Salmin Date: Thu, 11 Feb 2010 14:42:00 -0000 Message-ID: <87a8dc11002110613g5ce4b9bas348cc67a001b86e3@mail.gmail.com> Subject: Re: Why is gcc going to default to "GNU dialect of ISO C99?" To: dclarke@blastwave.org Cc: gcc-help@gcc.gnu.org, aph@redhat.com, david.kirkby@onetel.net, ams@gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2010-02/txt/msg00165.txt.bz2 On Thu, Feb 11, 2010 at 8:00 PM, Dennis Clarke wrot= e: > >> On Thu, Feb 11, 2010 at 7:40 PM, Dennis Clarke >> 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 >>>> =A0int main() { >>>> =A0 printf("a"); >>>> =A0 int a; >>>> =A0 printf("b"); >>>> =A0 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. >>> > >> >> 334 lines of research for 7 lines of code :) >> >> Alexey > > Here are 7 more :-) > > $ lint -v -Nlevel=3D4 -Xc99=3Dall sample1.c > > variable unused in function > =A0 =A0(9) a in main > > function returns value which is always ignored > =A0 =A0printf > > > -- > Dennis Clarke > dclarke@opensolaris.ca =A0<- Email related to the open source Solaris > dclarke@blastwave.org =A0 <- 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