Bracket styles: Allman vs. K&R

February 28, 2012 at 3:37 PMMadestro

I have been coding for a number of years now and most of the code I have come across (I would say 98%, no exaggeration) is in Allman's format.

For those of you who are not familiar with these bracket styles (or maybe you are but don't associate the name with the style), Allman's format is about putting the brackets each in its own line:

if (a == b)
{
     return true;
}
else
{
     return false;
}

While K&R is about putting the bracket at the end of the control statement:

if( a == b) {
     return true;
} else {
     return false;
}

I personally like Allman's. In my opinion it's totally easier to read. This of course is my personal preference. Either method [obviously] works and produces the same result, but I do find having to read K&R style annoying. So annoying in fact that I decided to write this post... :-)

Thoughts?

Posted in: General Development

Tags: