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

Re: [leafnode-list] Coding Style



On 21 Jan 2001, Matthias Andree wrote:
> 
> I encounter a lot of lines like these, just picking one randomly:
> 
> xoverutil.c:    close( fd );
> 
> 
> What's the rationale behind violating ANY typography rules and put
> blanks on the _INSIDE_ of parentheses?  It's not readibility, that
> suffers because things are torn apart.

This is a popular coding style. I don't know why, I think it
looks a bit ugly. But lots of people seem to like it.

 > Next: spacing on if, return etc:
> 
> xoverutil.c:    return(helpfindxover( article, 0, xcount-1) );
> 
> Apart from the bsearch function that is ANSI standard, return is a
> statement, so one better writes:
> 
>         return (helpfindxover(article, 0, xcount - 1));

I agree that return shouldn't be coded so it looks like a function 
call.
 
> or, omitting one level of excess parentheses:
> 
>         return helpfindxovers(article, 0, xcount - 1);

This is the simplest way of doing things, so it has that in it's
favour aesthetically.

> and a following indent -i4 -kr run, that's just fine, be it as automatic
> as possible to keep the administrator overhead low.

If coding guidelines are to be enforced (e.g. for detection of changed
lines) then doing it via an automatic process such as what you propose
seems sensible, IMO.

-- 
***** Phil Hunt ***** 
"An unforseen issue has arisen with your computer. Don't worry your silly 
little head about what has gone wrong; here's a pretty animation of a 
paperclip to look at instead."
         -- Windows2007 error message



-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list