Hendrik Schober
10/10/2008 8:14:00 AM
Chris Ahlstrom wrote:
> After takin' a swig o' grog, Erik Wikström belched out
> this bit o' wisdom:
>
>> I'd say as short as possible without sacrificing the readability of the
>> code, but keep in mind that a modern monitor is wide. I also think that
>> different standards can be applied to different kinds of lines, I really
>> hate things like this:
>>
>> SomeReturnType SomeClass::SomeMethod(SomeType1 artument1,
>> SomeType3 argument3,
>> SomeType4 argument4,
>> SomeType5 argument5,
>> SomeType6 argument6,
>> SomeType7 argument7)
>> {
>> // ....
>> }
>>
>> Since you (in my experience) seldom have to read or change the arguments
>> of functions (at least of working on a large code-base with a few years
>> worth of code) you can just keep them all on one line, which gives a
>> more uniform formatting of functions and makes it easier to quickly scan
>> the code.
>
> I disagree violently <grin>.
>
> SomeReturnType
> SomeClass::SomeMethod
> (
> SomeType1 artument1, /**< Destination for the stuff. More comment.*/
> SomeType3 argument3, /**< blah blah blah */
> SomeType4 argument4, /**< blah blah blah */
> SomeType5 argument5, /**< blah blah blah */
> SomeType6 argument6, /**< blah blah blah */
> SomeType7 argument7 /**< blah blah blah */
> )
> {
> // ....
> }
Just for diversity, I like this:
SomeReturnType SomeClass::SomeMethod( SomeType1 argument1 /**< Destination for the stuff. More comment.*/
, SomeType3 argument3 /**< blah blah blah */
, SomeType4 argument4 /**< blah blah blah */
, SomeType5 argument5 /**< blah blah blah */
, SomeType6 argument6 /**< blah blah blah */
, SomeType7 argument7 /**< blah blah blah */ )
: data1(argument1)
, data3(argument3)
, data4(argument4)
, data5(argument5)
, data6(argument6)
, data7(argument7)
{
// ....
}
(But then I had never had to look at code at a machine which
only has vi. And hopefully I'll never will. :^> )
> [...]
Schobi