On Monday, May 11, 2015, Xidorn Quan <quanxunz...@gmail.com> wrote: > On Tue, May 12, 2015 at 7:29 AM, Ehsan Akhgari <ehsan.akhg...@gmail.com > <javascript:_e(%7B%7D,'cvml','ehsan.akhg...@gmail.com');>> wrote: > >> On 2015-04-30 7:57 AM, Xidorn Quan wrote: >> >>> On Thu, Apr 30, 2015 at 10:14 PM, Robert O'Callahan < >>> rob...@ocallahan.org >>> <javascript:_e(%7B%7D,'cvml','rob...@ocallahan.org');>> >>> wrote: >>> >>> On Sat, Mar 21, 2015 at 4:14 AM, <bo...@mozilla.com >>>> <javascript:_e(%7B%7D,'cvml','bo...@mozilla.com');>> wrote: >>>> >>>> * member initializers >>>>> >>>>> >>>> Should we have any rules around these, or should we use them >>>> indiscriminately? I wonder particularly about initializers which are >>>> complicated expressions. >>>> >>>> >>> I guess we probably should forbid using any expression with side effect >>> for >>> member initializers. >>> >> >> Hmm, why should we restrict them more than what can appear in the >> constructor initializer list > > > Because it seems to me that, the member initializers are more obscure for > their initializing order. Given they can be disperced widely in different > places, it would be far harder to reason out the correctness from a piece > of code if the initializers could have side effect. >
That's a good point! But I think expressions with side effects doesn't really narrow down the issue. It's more an expression that can affect what other expressions in the initializer list get evaluated to. And even that issue is not specific to C++11 member initializers, the old school ones are similarly affected (and in fact the initialization order is exactly the same, based on the order of declarations, bases first.) but at least with those you will get a compiler warning if you mistype the initialization order in the body of the constructor... In short, I still don't see an issue that is specific to C++11 member initializers. -- Ehsan _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform