Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2001 17:31:44 -0800
From:      "Freddie Cash" <fcash@bigfoot.com>
To:        freebsd-chat@freebsd.org
Subject:   Re: silly C style question 
Message-ID:  <3A6C6E80.4535.632D3C1@localhost>
In-Reply-To: <200101221743.f0MHh7I61638@gratis.grondar.za>
References:  <20010122170600.D4456@dogma.freebsd-uk.eu.org> ; from j mckitrick <jcm@FreeBSD-uk.eu.org>  "Mon, 22 Jan 2001 17:06:00 GMT."

next in thread | previous in thread | raw e-mail | index | archive | help
On 22 Jan 2001, at 19:43, Mark Murray wrote:
> > This is a trivial question, but I get hung up on details, so I'm gonna
> > ask anyway.  ;)

> OOOOOPPPPPPENNN Bikeshed! ;-)

> > When using opening and closing braces for a loop or other control
> > structure, most coders put the opening brace on the same line as the
> > decision statement.  It seems to me, using it in more of a block format
> > would make the code easier to read.  Does this make sense?

> > if (0 == i)
> > {
> > 	foo(i);
> > 	bar(i);
> > }

> IMHO, this wastes one line of screen space. I only use it for functions.

Bah!  If you are worried about screen space and legibility, there's 
always the following:

if (0==i)
  { foo(i);
    bar(i);
  }

which is what we use here.

> > versus
> > 
> > if (0 == i) {
> > 	foo(i);
> > 	bar(i);
> > }
> 
> "Classic" K&R. Allows a little more code per screen.

However, there is no such thing as "The One True Style" just as there is 
no such thing as "The Perfect Pair of Pants", or "The One True Cookbook". 
 Everyone has their own way, and so long as it is legible to the vast 
majority, then it works for me.

Cheers
Freddie
fcash@bigfoot.com

----------
Hackers make toys. Crackers break them.
    -- Peter Seebach

For my public PGP key, send e-mail with subject:
                       PGP KEY REQUEST


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A6C6E80.4535.632D3C1>