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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4873305131bf4d94 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public From: fred@genesis.demon.co.uk (Lawrence Kirby) Subject: Re: Porting (was ADA and Pascal etc) Date: 1997/11/02 Message-ID: <878495810snz@genesis.demon.co.uk>#1/1 X-Deja-AN: 287472093 References: <34557f2b.1934172@news.mindspring.com> <63bhta$g2e@bgtnsc03.worldnet.att.net> <345AB871.413A@dynamite.com.au> <63d5l4$tub$1@helios.crest.nt.com> X-Mail2News-User: fred@genesis.demon.co.uk X-Complaints-To: abuse@demon.net X-Mail2News-Path: genesis.demon.co.uk X-Trace: mail2news.demon.co.uk 878518340 6274 fred genesis.demon.co.uk Organization: none Reply-To: fred@genesis.demon.co.uk Newsgroups: comp.lang.ada,comp.lang.c Date: 1997-11-02T00:00:00+00:00 List-Id: In article <63d5l4$tub$1@helios.crest.nt.com> kaz@helios.crest.nt.com "Kaz Kylheku" writes: ... >What's worse is that mixed declarations and statements are likely going to be >part of the new C language. Actually that finally resolves one of the biggest bugbears I have when writing C. My experience has shown clearly that localising declarations can be a big win for readability. Currently I have to use extra { }'s to do that in some cases (notably for switch cases). With C9X I will finally be able to write code in a natural way according to my preferred coding style. Of course like may other features of C it will be possible to abuse this to horrific effect. Nevertheless overall it is a win for the language. >Ada makes so much more sense by requiring data declarations to precede the >function body. Only scatter-brained programmers see a stylistic advantage in >declarations interspersed with statements. Perhaps I'm scatter-brained. I see advantage for locality of scope. This also helps in specifying invariants with careful use of const. >It's perhaps a remnant of brain >damage inflicted by programming in BASIC. I try to even avoid declarations at >the beginnings of nested blocks, even though C allows it. It's not necessary. Of course it is not necessary but it can be very beneficial when used sensibly. -- ----------------------------------------- Lawrence Kirby | fred@genesis.demon.co.uk Wilts, England | 70734.126@compuserve.com -----------------------------------------