Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!munnari.oz.au!metro!ipso!runxtsa!edward From: edward@runxtsa.runx.oz.au (Edward Birch) Newsgroups: comp.lang.c++ Subject: C++ coding standards (Comment needed) Keywords: standard,variables Message-ID: <2161@runxtsa.runx.oz.au> Date: 12 Aug 90 02:46:29 GMT Organization: RUNX Unix Timeshare. Sydney, Australia. Lines: 33 A friend of mine works with a large organization where they have defined a standard that "variables must be declared where first used". I think that this is an absolutely insane standard for the following reasons: o The declarations clutter the algorithm. o Most C and C++ programmers are used to seeing variables declared in one place. I believe that changing this will only add to maintenance costs and development time. C has had the ability to declare variables at the start of each block. How often is it used ? Why isn't it used ? o I have found that declaring variables where they are first used significantly adds to the development time of code. With little benefit to the over all presentation of the code. o I also find that declaring variables at the start of functions in one spot to significantly adds to the readability of the code. I would be extremely interested in feedback. Edward Birch Phone: +612 2 958-2119 UUCP: seismo!munnari!runx.oz!edward ACSnet: edward@runx.oz ARPA: edward%runx.oz@seismo.css.gov CSNET: edward@runx.oz -- Telex: 10713856 BRHT UUCP: seismo!munnari!runx.oz!edward ACSnet: edward@runx.oz ARPA: edward%runx.oz@seismo.css.gov CSNET: edward@runx.oz