🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3906

Re: "Canadian style" of indentation

#3906
From: Ian Cargill
Date: Sun, 03 Sep 1995 14:34
61 lines
2463 bytes
In article <4255vr$12@mujibur.inmind.com> mfinney@inmind.com writes:

>Given those considerations, requiring that a particular indentation
>style be followed for all users of a langauge is not that obnoxious.
>Especially when the benefit of doing so is to make code syntax
>simpler (to a human) and to reduce the number of bugs.  Not to
>mention reducing typing!  Finding problems such as...
>
>   if (aTest)
>         aStatement1;
>      else
>         aStatement2;
>         aStatement3;
>
  <snip>
>
>And, wait there's more! <GG>, not only did I eliminate
>braces and semicolons, but I was also able to eliminate
>other parts of the syntax (such as "else if" in a else-if
>chain).  My tests indicated that those rules resulted in
>about a 30% non-white space reduction in a typical
>program.  Perhaps less today, with longer variable and
>function names common.

And, of course, you will have to mandate the width of tabs 
and/or forbid the use of tabs.  Otherwise, what happens when 
you edited with tabs set to 8 and the compiler expects 4?

  --->  tab
  ....  spaces

Edited:

....if(aTest)
........aStatement1;
....else
........aStatement2;
------->aStatement3;


Compiled:

....if(aTest)
........aStatement1;
....else
........aStatement2;
--->aStatement3;		//  whoops.


I would much rather rely on layout-independant braces to define 
my block scope.

What happens when someone fouls up with global search and replace 
or strange editors which changes the spacing/indentation?  I have 
had both done to me and it would have been a nightmare having to 
go laboriously through code re-creating the block structure.

--
============================================================================
 Ian Cargill  CEng MIEE |  Find out about the Association of C and C++ Users
 Soliton Software Ltd.  |  info@accu.org  OR http://bach.cis.temple.edu/accu
Technical Details
Message-ID: <810138845snz@soliton.demon.co.uk>
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!soliton.demon.co.uk
References: <41g464$6vv@ruby.ucc.nau.edu> <41gvsi$hfv@mujibur.inmind.com> <DE616L.6xq@ns1.nodak.edu> <4255vr$12@mujibur.inmind.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!soliton.demon.co.uk
From: Ian Cargill <ian@soliton.demon.co.uk>
Newsgroups: comp.std.c
Subject: Re: "Canadian style" of indentation 
Date: Sun, 03 Sep 95 14:34:05 GMT
Organization: Soliton Software Ltd.
Message-ID: <810138845snz@soliton.demon.co.uk>
References: <41g464$6vv@ruby.ucc.nau.edu> <41gvsi$hfv@mujibur.inmind.com> <DE616L.6xq@ns1.nodak.edu> <4255vr$12@mujibur.inmind.com>
Reply-To: ian@soliton.demon.co.uk
X-NNTP-Posting-Host: soliton.demon.co.uk
X-Newsreader: Simple NEWS 2.0 (ka9q DIS 1.24)