Curly braces
-
Are you in this camp
void AFunc(){
}or this one
void AFunc()
{
}I'm in the second
Life should not be a journey to the grave with the intention of arriving safely in a pretty and well-preserved body, but rather to skid in broadside in a cloud of smoke, thoroughly used up, totally worn out, and loudly proclaiming “Wow! What a Ride!" - Hunter S Thompson - RIP
This is the only correct way:
void AFunc() {
}Embrace it. Join the dark side. :-\
Jeremy Falcon
-
The first style is usually called "K&R", while the second is often named Allman. There are countless variations based on indentation of the following code body. I started out using K&R when I learned 'C' from, er, the K&R. When I learned C# where the convention leans hard toward Allman, I found I preferred Allman braces. I have significant visual problems: myopia, astigmatism, presbyopia, and glaucoma in the left eye, and the right one is made of plastic. Did I mention the cataract forming in the left eye? Allman adds white-space and highlights braces, both of which improve readability greatly for me. One good thing about venerable VS2008 still being an active tool in our shop is that I have a Visual Studio editor macro that converts K&R style to Allman. I don't like the reformatters in later editions of Visual Studio.
Software Zen:
delete this;
I'm totally K&R, but I upvoted this anyway just because you're cool. #no_shame
Jeremy Falcon
-
I'm totally K&R, but I upvoted this anyway just because you're cool. #no_shame
Jeremy Falcon
Thanks Jeremy. Glad to see you coming around here again!
Software Zen:
delete this;