From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-07-09 03:51:40
Darren Cook wrote:
>>>It's certainly not to be done without understanding the
>> But the same user will be equally unprepared to unspecified evaluation
>> order in
>> A = get(), get(), get();
>> and in
>> A.assign_list(get())(get())(get()) ;
>> There's nothing specific about operator,();
> A << get() << get() << get() ;
> always work the way the user expects,
I think user will still expect specific evaluation order above. And from
standard point of view, it does not have more sequence points than either
of the other versions. Finally, this still looks like formatted insertion
> even when they switch all optimizations on?
It's almost impossible (IMO) for compiler to get the unexpected evaluation
order in either case. For agruments of one function call, compiler will
likely to evaluate arguments either staring from the first one, or from the
last one, depending on the calling conversion.
(or for comma), it's very unlikely that compiler will start by evaluating
all 'get()' calls and then proceed by calling operator(). It's a strange
logic to implement, and would require you too keep all results from 'get()'
somewhere, increasing register pressure.
So maybe, it's mostly theoretic issue.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk