+1

Indentation to match Google style guide in indent to bracket mode

Peter Hawkins hace 12 años actualizado por Luc Bourhis hace 12 años 1

I'd like to write code matching Google's C++ style guide:

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Function_Declarations_and_Definitions#Function_Declarations_and_Definitions


Indent to bracket mode supports this style already:

ReturnType ClassName::ReallyLongFunctionName(Type par_name1, Type par_name2,
                                             Type par_name3) {
  DoSomething();
  ...
}

In the event that the parameters are too long to fit on the line, I'd like to use this style:

ReturnType LongClassName::ReallyReallyReallyLongFunctionName(
    Type par_name1,  // 4 space indent
    Type par_name2,
    Type par_name3) {
  DoSomething();  // 2 space indent
  ...
}

I second that. Actually XCode has the same issue: typing "enter" after an open parenthesis move the cursor vertically in the same column and one is then forced to hit "backspace" a few times to get the second layout in Peter's message. And since one never knows how many time backspace has to be hit, this gets rather cumbersome.