From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,96ae138aab3beb03 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-11 00:16:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!howland.erols.net!news-out.worldnet.att.net.MISMATCH!wn4feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail From: "David Thompson" Newsgroups: comp.lang.ada References: <3CF77998.9040806@yahoo.com> <3CF77CDA.3090805@yahoo.com> Subject: Re: Localized Variable Declaration X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Tue, 11 Jun 2002 07:16:31 GMT NNTP-Posting-Host: 12.89.134.205 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1023779791 12.89.134.205 (Tue, 11 Jun 2002 07:16:31 GMT) NNTP-Posting-Date: Tue, 11 Jun 2002 07:16:31 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:25728 Date: 2002-06-11T07:16:31+00:00 List-Id: Stephen Leake wrote : > "Marin David Condic" writes: > > > I disagree with the style issue, but the last time I checked, I could > > declare variables in C in the middle of the code. They can even be scoped > > with {}, IIRC. Maybe that's not "standard" C? It seems to go past the gcc > > compiler I'm using. > C has always (or at least since before K&R1) allowed declarations at the beginning of any compound statement (delimited by braces), not just the compound statement which is the body of a function. This distinction was not kept clear in most of the thread. > To get the Gnu compiler to enforce the ANSI C 89 > standard, use the switches -ansi -pedantic. > > Anyone know when Gnu C will support C99? ... Yep. Note that C99, like C++ and GNU-C, allows declarations "anywhere" a statement is valid (except immediately after a label). (Like PL/1. ) And C99 like C++ has a form of the for statement that locally declares the loop variable. Hmm, anyone recall which way(s) algol went on this? IIRC LISP allows declarations anywhere as well as nowhere. (That is, they are optional, but if used can be anywhere.) -- - David.Thompson 1 now at worldnet.att.net