On Sat, Nov 04, 2006 at 07:09:50PM -0700, Levi Pearson wrote:
>
> space. What is the point of putting curly braces on lines all by
> themselves?
It looks better.
> if (str[x+1] == charclose) { depth--; }
> }
> if (str[x] == charclose) { c_close++; }
> }
>
> if (c_close != c_open) { cout << 0 << endl; }
> else { cout << depth+1 << endl; }
> }
> }
>
> Is there some reason I'm missing to prefer the extremely long version
> over the shortened one?
Yes. It looks better. Code should be written with readability in mind.
"Beautiful is better than ugly".
Braces on the same line as opposed to a line by itself is personal
preference. But if (foo) { do something } is butt ugly and makes it
harder to read, and should be avoided IMNSHO.
-Roberto
--
"If I do not return to the pulpit this weekend, millions of people will go
to hell."
-- Jimmy Swaggart, 5/20/88
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/