Curly brace OCD

 

Why do people do this

void foo(){
   stuff...
}

instead of this?

void foo()
{
   stuff...
}
 

For me, it's a matter of personal style.

Plus, for those who use a text editor (like Notepad++) that has text-folding, it looks better when the text is folded.  See below.

Unfolded text: 

Example of unfolded text in Notepad++

 Folded text:

Example of folding in Notepad++ 

 
FlatFap:

Why do people do this

instead of this?


Why do people do this . . .

void foo()
{
   stuff...
}

 instead of this ?

void foo()
   {
   stuff...
   }
 
RaptorUK:


Why do people do this . . .

 instead of this ?



Because that's two extra key strokes to indent each brace and the function braces are 'master' braces containing the inner code, so it get's messy when using for loops et al.

Your point is valid; whatever floats your boat.

 
FlatFap:
Why do people do thisinstead of this?
void foo(){
   stuff...
}
void foo()
{
   stuff...
}
When you start programming on a VT100 or earlier terminal, you only have 24 lines visible. Saves vertical space so you can see more code. Affects code folding. Styles created are based on available tools.
 
FlatFap:

Because that's two extra key strokes to indent each brace and the function braces are 'master' braces containing the inner code, so it get's messy when using for loops et al.

Your point is valid; whatever floats your boat.

We all have our preferences,  the most important thing is consistency of your approach, especially if one day you ask other people to read or help with your code. ;-)
Reason: