[Development] when to Extract Method (was Re: commas in ctor-init-lists)

Edward Welbourne edward.welbourne at qt.io
Fri Jun 3 15:10:42 CEST 2016

Thiago Macieira
> Another thing to be very, VERY careful is about nested function call
> chains, as in:
>        if (foo(bar(), baz(quux()), variable, xyz()) == variable)
> Can you tell me if bar, baz, quux, or xyz modify variable? If so, what
> is the call order?

If any of bar, baz, quux or xyz plausibly might modify variable, then
this code has undefined behaviour - because the call order is undefined.
(... except for quux() being called before baz; and baz, bar and xyz
being called before foo, of course; the point in all that at which
variable's value gets read is indeterminate, any which way.)

Not that I see how this bears on whether that complex call to foo()
should be extracted as a separate method,


More information about the Development mailing list