views:

112

answers:

2

I've gotten the gist that the following

<T> my_function(...) {
   ....
}

is preferred by most, compared to:

<T> my_function(...) 
{
   ....
}

Likewise for:

if (...) {
   ...
}

being preferred over

if (...) 
{
   ...
}

Is this true and if so, why is the former style preferred over the latter?

+2  A: 

This isn't necessarily preferred - they're different styles, and different teams have their own preferences.

Many people prefer the former because the code becomes shorter and more "concise". Many people prefer the latter because it's easier, at a glance, to see that the opening parenthesis character was put in place. However, these are both preferences, and different people prefer different things (and even different than the ones you displayed, such as using indented parens, etc).

Reed Copsey
A: 

The first one is popular mostly, because it is demanded by Sun (Now: Oracle) in Java

TBH
dmckee
Indeed, always postponing.
TBH