Kleuskes & Moos
5/10/2011 11:01:00 PM
On May 10, 11:22 pm, Seebs <usenet-nos...@seebs.net> wrote:
> On 2011-05-10, Kleuskes & Moos <kleu...@xs4all.nl> wrote:
>
> > {
> > /* Some comment */
> > including one too few "{" and "}"
> > }
> > I'm sure you'll make a lot less errors. Braces are so important in
> > determining the structure of a C program, they deserve their own line.
>
> This is not 1TBS. Therefore it's wrong.
:).
> Here's the thing: Brace styles are all viable. Any of them will work.
> But it's VERY useful to have everyone use the same style.
True. It's also very handy to be able to easily spot where you went
wrong, especially with important language elements such as braces. If
you think otherwise, feel free to do it otherwise.
Many program-editors offer nice colorful indicators to match '{' with
'}' and '(' with ')'. I suggest you turn that on, too.
> There is no way to pick a standard except by appeal to authority.
I'm merely offering a colleage some advice that worked quite good for
me. All the places i worked that actually HAD a formalized coding
style (the best half of my employers, and you don't wanna know about
the worst ones), demanded separate lines for braces. But that's just
me and those silly employers of mine.
> Therefore, use the brace style from K&R. That's the closest we'll ever
> have to a proper authority.
Arguments from authoroty are never quite satisfying, and a debate is
quite useless (and endless), so i'm not getting into that. In my
current firm, where I am the sole and undisputed authority on these
matters, K&R can go screw themselves in this respect, however much i
admire them for their work.
What you do in your code, is your business.
> > And don't try to tell me that whitespace costs money, since that's
> > only valid on paper.
>
> It's not money, it's visual real estate. I can only see so many lines
> at a time. Seeing a few more lines of code at a time is a pretty noticeable
> payoff.
After years of contemplating the matter, i arrived at the conclusion
that it is unwise to want as much information as possible on your
screen. What you want is the _right_ information, and to be able to
spot it quickly.