18 January 2007

Does bracket alignment matter?

I'm in the throes of trying to get some code out and it looks to be an anti-Massonian proposition. Along with other design and coding duties, I'm promulgating formal coding standards, project architecture, et cetera ad infinitum. One of the things that there seems to be near uniform consensus among our programming group is that brackets should align, in all contexts, thus:

if (! brackets_aligned_p)
{
go_apeshit_ballistic();
}

For a while, I was fairly ambivalent about this, but GNU did give me the heebie jeebies:

if (brackets_gnu_aligned_p)
{
all_hail_emacs();
}

C++ has put me over the edge in the other direction with namespaces. I simply cannot abide:

namespace foo
{
namespace bar
{

// your nested namespace code here

class CodeBastard : public CynicalBastard
{

};

} // end namespace bar
// end namespace foo

Unanimous vote minus one for this. I cannot put my finger on the source of my loathing, and why I find:

namespace foo {
namespace bar {

// your nested namespace code here

class CodeBastard : public CynicalBastard
{

};

} // end namespace bar
// end namespace foo

soooooo much less offensive, and

namespace foo {
namespace bar {

// your nested namespace code here

class CodeBastard : public CynicalBastard {

};

} // end namespace bar
// end namespace foo

now strangely compelling when at one time I didn't give a rat's ass. I never noticed it before, because I always did namespace brackets on the same line, regardless of the other ways we were doing functions and control structures. Even the GNU stuff was shudder and get on with it. Now I care, and I don't know why. Back at it.

2 comments:

Codie said...

*LMAO* Thanks, I how have a function call to my own name ;)

CodeBastard Redgrave, citizen of the SecondLife metaverse

g said...

You have your very own class, but do you inherit CynicalBastard? What's that constructor going to look like?

Cheers,

g