www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/07/15:38:21

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Bracketing: A Matter of Style
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <0ktres064fui2f1p8icossklbnn3ntdeu6@4ax.com>
References: <38EBD03D DOT 895D1680 AT mindspring DOT com> <38EBFBD7 DOT 7D03CB96 AT hotmail DOT com>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 60
X-Trace: +Lqm+8saM0pFFeRATRGYNSR5Re7b3BcBOhcwTm2H4L+YgYRJvLCIcFvedwZR1KB0BmbuiV3xvFKO!1DZKm7aJDViOiBNaLX1eUya46zRPty+EmCLlvRcSQQX0cBqdw5XjXs/h2/iPRbsCbHqyymxPofcp!CAk=
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Fri, 07 Apr 2000 16:21:52 GMT
Distribution: world
Date: Fri, 07 Apr 2000 16:21:52 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Thu, 06 Apr 2000 02:55:05 GMT, Andrew Hakman <hakmana AT hotmail DOT com>
wrote:

>I would have to agree with this. Since I started programming in c++ (in
>DJGPP right from the start!) 2 years ago, I was introduced to both
>bracketing styles, and liked the "lined up bracket" style right off the bat,
>only I usually do mine like this:
>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.  Another
>thing I hate (hope I'm not stepping on too many toes here) is using TABs for
>indents. For quite compact, yet very readable code I tend to use 2 spaces
>for indents.
>
>Guess it really comes down to personal preference!
>Andrew

I do the same thing (most of the time), although I have written some
files in GNU style (braces two spaces in, code two spaces inside
braces) because that's what Emacs automatically does.  (This lets
people see what editor I was using when I wrote a file:

// if it's Edit.com:
for(i = 0; i < 10; i++)
{
  foo(i);
  bar(i);
}

// if it's GNU Emacs:
for(i = 0; i < 10; i++)
  {
    foo(i);
    bar(i);
  }

>> int main(void) {
>>     printf("Hello, World!");
>>     return 0;
>>     }
>>
>> (...or some variation thereof).

That's "1tbs" or one true brace style, used in examples in K&R.

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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