[Fwd: Re: [Y-devel] Technical Notes]
James Harr james at grickle.org
Fri Feb 20 14:10:36 GMT 2004
I agree 100% with the brackets, they can shorten the vertical length of a
statement, however sometimes I tend to forget there's a { after a condition
like that.
I would like to add that after long 'if's (25 lines or so long) that it's good
to add a small note about what the 'if' is about.
if ( x > y )
{
// 25+ lines
} // x > y
This can help readability much, not just on if statements, but on long
functions or on huge loops.
On Thu February 19 2004 16:58, Matt Wilson wrote:
> I'd definitely have to disagree with that for a few reasons;
>
> * 8 character tabs (rather than 2 or 4, 2 being my personal pref.)
> * tabs (rather than spaces)
> * braces positioning
>
> The reason I mention the positioning of braces is that when you have
> lots of code, readability is a massive issue and;
>
> if ( .. ) {
> // do something
> }
>
> takes much longer to read (in terms of skimming through source looking
> for something) than the alternative;
>
> if ( ... )
> {
> // do something
> }
>
> Likewise for other constructs; 'for, 'while, 'do' and function
> definitions.
>
> Though I'm sure I'll receive some flame material for saying that :P
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved