monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFD: C style [was Re: event engine patch update]


From: Jan-Henrik Haukeland
Subject: RFD: C style [was Re: event engine patch update]
Date: Mon, 29 Mar 2004 01:04:45 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Reasonable Discussion, linux)

Martin Pala <address@hidden> writes:

> How should GNU C indentation style look like in reality? I don't use
> emacs, my favorite editor is vim :)

http://www.gnu.org/prep/standards_23.html#SEC23, but oops I thought
the gnu style was a version of K&R but apperently not :-/ The gnu
style is gruesome. What we have been using in monit is a variant of K&R. 

Here's a list of various styles: (see also
http://blogs.msdn.com/danielfe/archive/2003/11/24/51893.aspx)


1. K&R/One True Brace  (4/8 spaces per tab, monit uses 2 per tab)               
 
while (condition) {            
    dependent code;                                        
}                                       
                                        
2. BSD/Allman
while (condition)
{
    dependent code;
}

3. "Linux"  (same as k&r but with tabs at 8 spaces)                        
while (condition) {                                     
        dependent code;               
}                    

4. GNU
while (condition)
  {
    dependent code;
  }


It's a bit late to get into a discussion about the style, but looking
at the monit code it *is* a bit tight with only 2 spaces per tab. The
monit code could certainly be easier to read and will look better with
more spaces per tab, at least 4. (Yes I know, it's my fault originally, 
but it's never to late to change opinion is it). So I would like to
propose a change to the monit coding style. I may have opened a box of
"something" with this, but I take my chances.

Lately I have started to use the Linux style but I'm open on
this. What do others prefer? Should we do a job and use a better
style? Martin (Allman), Christian and Rory, what do you think? Use a
new style or status quo?

-- 
Jan-Henrik Haukeland




reply via email to

[Prev in Thread] Current Thread [Next in Thread]