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

Re: OT: Why is C so popular?



On Thu, 2003-08-28 at 14:50, Steve Lamb wrote:
> On Thu, 28 Aug 2003 16:35:25 +0200
> Francois Bottin <fbottin@free.fr> wrote:
> > Compare it with SUN's recomendations for Java (but useable also for C):
> > if (cond) {
> >     block;
> > } else {
> >     block;
> > }
>  
> > In this case I find it much better than the GNU Coding Standards, and there
> > is only one line more than Python...
> 
>     Except the else does not line up with the if and it is too easy to skip
> over that line with your eyes and miss what it is.

Actually, that's exactly my preferred coding style. The closing brackets
always line up with what they're closing. Using the long approach of

if (cond)
{
    block;
}
else
{
    block;
}

Has the same effect, but that's way too much wasted space.

I think it all just boils down to personal preference and what people
can see most easily. I can easily pick out an } else { while my eyes get
confused with having to line things up over long vertical distances.
Other people have the opposite problem. I think people should just use
whatever they're most comfortable with that's possible in their
environment. (e.g. I don't think it's possible to do a } else { line in
python even when using comments because you'd have comment code comment
on one line)

-- 
Alex Malinovich
Support Free Software, delete your Windows partition TODAY!
Encrypted mail preferred. You can get my public key from any of the
pgp.net keyservers. Key ID: A6D24837

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: