delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/07/12:52:21

From: "Campbell, Rolf [SKY:1U32:EXCH]" <moscoop AT americasm01 DOT nt DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bracketing: A Matter of Style
Date: Fri, 07 Apr 2000 09:58:08 -0400
Organization: Nortel Networks
Lines: 40
Message-ID: <38EDE96F.8399773E@americasm01.nt.com>
References: <38EBD03D DOT 895D1680 AT mindspring DOT com> <38EBFBD7 DOT 7D03CB96 AT hotmail DOT com>
NNTP-Posting-Host: wmerh0tk.ca.nortel.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.72C-CCK-MCD [en] (X11; I; HP-UX B.10.20 9000/785)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Andrew Hakman wrote:

> int main(void)
> {
>     printf("Hello, World!");
>     return 0;
> }
>
> you can tell where functions, loops, etc. end and eliminates the need for
>
>        }   //end of whatever - this comment I see in other people's code all
> the time because there final closing bracket doesn't line up with their
> function, and they can't figure out what it is closing otherwise.

If your function is more than a page, you can't see what it is 'lined up' with
anyways.  I think that flow-of-code is more important than lining up braces,
but this might be because I use XEmacs which automatically shows me the
matching brace.  (They are not brackets.  "[ ]" are brackets, "( )" are
parentheses - also called parens, and "{ }" are braces).

I personally code as follows:

int main() {
  printf("Hello world");
  return 0;
  }

or

int class::method()
  : member(value)
{
  body();
  }

--
(\/) Rolf Campbell (\/)



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019