[Development] commas in ctor-init-lists

André Somers andre at familiesomers.nl
Fri Jun 3 15:02:23 CEST 2016



Op 03/06/2016 om 14:52 schreef Marc Mutz:
> On Friday 03 June 2016 14:26:03 André Somers wrote:
>> Op 03/06/2016 om 13:53 schreef Marc Mutz:
>>> On Friday 03 June 2016 10:05:52 Edward Welbourne wrote:
>>>>     if (somee.really(long.and.complicated, expression) ||
>>>>     another.such(that,
>>>>
>>>> makes, the.line.too.long) || and.then.some.more())
>>> To be perfectly blunt: such expressions shouldn't be allowed. Period.
>>> Neither with nor without line breaks. Such monsters should be subjected
>>> to Extract Method with extreme prejudice.
>>>
>>> Thanks,
>>> Marc
>> Fine. Lets replace it with something like this then:
>>
>> if (theValue ==
>> MyNameSpace::MyLongAndComplicatedClassName::MyClassEnum::TheValue1 ||
>> theValue ==
>> MyNameSpace::MyLongAndComplicatedClassName::MyClassEnum::TheValue2 ||
>> theValue ==
>> MyNameSpace::MyLongAndComplicatedClassName::MyClassEnum::TheValue3) {
>>
>> }
> Umm... same thing?
>
> What I'm saying is:
>
> - Multi-line conditions in if statements should *always* be refactored to a
>    single function call.
>
> Then we don't need to talk about how to format multi-line ifs at all, because
> they do not exist anymore.
Eh... So you move the same to a different method. How does that help? 
You'd basically get the same expression but then in a method of it's own?

> [...]
>
> We have the same problem in .pro files: QtC just appends new files, always
> creating a patch the churns the old-last line in SOURCES. If it would sort
> them in lexicographically, most additions would be one-liners.
I requested this quite a while ago already.

André



More information about the Development mailing list