Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!princeton!udel!wuarchive!cs.utexas.edu!news-server.csri.toronto.edu!clyde.concordia.ca!ccu.umanitoba.ca!salomon From: salomon@ccu.umanitoba.ca (Dan Salomon) Newsgroups: comp.lang.c Subject: Re: Coding Standards. was: a style question Message-ID: <1990Nov20.181319.2952@ccu.umanitoba.ca> Date: 20 Nov 90 18:13:19 GMT References: <1990Oct23.160116.10299@athena.mit.edu> <13@christmas.UUCP> <14369@smoke.brl.mil> <1990Nov10.191840.21113@clear.com> <7267@hub.ucsb.edu> <6733@uceng.UC.EDU> <1990Nov18.005030.28841@zoo.toronto.edu> <6741@uceng.UC.EDU> Organization: University of Manitoba, Winnipeg, Canada Lines: 37 In article <6741@uceng.UC.EDU> dmocsny@minerva.che.uc.edu (Daniel Mocsny) writes: >In article <1990Nov18.005030.28841@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: > > It is also felt that programmers can do a better job of making clear > > the complete visual layout of a function or file, with the normal > > attention to detail of a careful programmer\*f. > > ... Saying the programmer > can do a better job at source formatting is equivalent to saying that > we cannot rigorously define a standardized coding style. A rigorously > defined style would be suitable for implementing in a beautifier > and compliance-checking program. If this is not possible, then what > we call "good program style" must necessarily remain somewhat vague. > The real problem is that to prepare the ideal layout for a program the beautifier would have to: (1) Read and understand the comments. This is especially true if the comments label the rows and columns of a table of data or expressions. (2) Understand the problem being solved, and the method being used. Blank lines in code segments can help delineate the steps in a computation, and spaces can be used to group related parts of an expression. (3) Know enough psychology to predict the human response to a layout. Layout choices made by a standard can be optimal in the general case but suboptimal in specific cases. All of these factors influence a complete program layout. It is still much easier for a programmer to do it while coding than for someone else to write a beautifier that can do it after the fact for any program at all. -- Dan Salomon -- salomon@ccu.UManitoba.CA Dept. of Computer Science / University of Manitoba Winnipeg, Manitoba, Canada R3T 2N2 / (204) 275-6682