You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Marr <gr...@alum.wpi.edu> on 2000/04/21 14:59:47 UTC

coding style == religion

At 06:54 AM 04/21/2000, Ben Laurie wrote:
>Greg Stein wrote:
> > On Fri, 21 Apr 2000, Brian Havard wrote:
> >> Another ugly practice that seems to be showing up is writing
> >> if's & for's without a space between the if/for & the (. The
> >> first I saw I thought it was just a typo but it occurrs in 28
> >> different .c files now.
> >
> > Yah. This is one of the absolute worst things that I've ever seen 
> in the
> > years that I've been coding. Brace placement? That's for sissies. 
> People
> > who write code that pretends "if" and "for" is a function should 
> simply be
> > regarded as insane. It's even worse than people who put a space 
> between a
> > function name and the open paren (e.g. x = foo (arg); ). Bleck.
>
>Jeez. Leaving out a space is "pretending its a function"? I don't 
>think
>so, its just a completly correct abhorrence of wasteful whitespace.
>
>The one that drives me nuts really is pretending to be a function,
>though: "return(0);". Augh.

Oh great, so Brian thinks my practices are ugly, Greg thinks I should 
be considered insane, and I drive Ben nuts.  There's nothing like a 
good religious war over coding styles.  It's almost as bad as vi 
fanatics vs. emacs fanatics, or Unix vs. Windows.  :)

My personal style preference is no space after if, for, and while, 
spaces around all math/logic operators, ((expr) && (expr)) for 
non-trivial exprs, for clarity, no space between a function name and 
the paren, and return(value); or just return;.  I also put braces on 
separate lines, lined up with the level of the code it contains, and 
never use tabs.  Gee, I wonder how many people's religions that 
violates.

--
Greg Marr
gregm@alum.wpi.edu
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"


Re: coding style == religion

Posted by Greg Marr <gr...@alum.wpi.edu>.
At 09:16 AM 04/21/2000, Brian Havard wrote:
>On Fri, 21 Apr 2000 08:59:47 -0400, Greg Marr wrote:
>
> >Oh great, so Brian thinks my practices are ugly, Greg thinks I 
> should
> >be considered insane, and I drive Ben nuts.
>
>Well, I think you're insane too but I'm more diplomatic than Greg :)

Thanks a lot, I really appreciate it.  :)

>I think you've got pretty much everyone covered there.

Good, I wouldn't want anyone to feel left out.

>Everyone has their own personal tastes, that's why we have a style 
>guide. I
>have my own preferences (EG I prefer size 2 indents) but I'm willing 
>to follow the established standards when working on a group project 
>and expect
>others to do likewise.

We have a similar guide where I work, but it's a bit less strict than 
Apache's, from what I remember.  It uses a 4 space indent, and no 
tabs, but leaves many of the whitespace and brace placement issues up 
to the individual author.

I really don't care about the size of the indents.  I used to use the 
default style provided by emacs's c-mode for the most part, which was 
rather strange at times, and use a 2 space indent.  I've always found 
that having the braces separate, and at the same level as the code it 
contains makes it easier to read, but there are people in my 
group  that put the braces at the same level as the code in which the 
block is contained, and other people who place the opening brace on 
the same line as the if/for/while.  My personal tastes are what makes 
the code the easiest for me to read, which makes my work easier, but 
I try not to push my styles on others.  (except when it comes to no 
tabs...)

--
Greg Marr
gregm@alum.wpi.edu
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"


Re: coding style == religion

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Fri, 21 Apr 2000 08:59:47 -0400, Greg Marr wrote:

>Oh great, so Brian thinks my practices are ugly, Greg thinks I should 
>be considered insane, and I drive Ben nuts.

Well, I think you're insane too but I'm more diplomatic than Greg :)


>There's nothing like a 
>good religious war over coding styles.  It's almost as bad as vi 
>fanatics vs. emacs fanatics, or Unix vs. Windows.  :)
>
>My personal style preference is no space after if, for, and while, 
>spaces around all math/logic operators, ((expr) && (expr)) for 
>non-trivial exprs, for clarity, no space between a function name and 
>the paren, and return(value); or just return;.  I also put braces on 
>separate lines, lined up with the level of the code it contains, and 
>never use tabs.  Gee, I wonder how many people's religions that 
>violates.

I think you've got pretty much everyone covered there.

Everyone has their own personal tastes, that's why we have a style guide. I
have my own preferences (EG I prefer size 2 indents) but I'm willing to
follow the established standards when working on a group project and expect
others to do likewise.

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------