|
Boost : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-07-09 02:39:43
Andrei Alexandrescu (See Website for Email) wrote:
> > > expect to always work, something like:
> > > v+= get(), get(), get();
> >
> > They surely will expect this to work and it might fail if 'get()' result
> > depend on the call order. In fact *any* convenient initialization syntax
>
> will
>
> > have this problem just becase you'd have single expression, and the order
>
> of
>
> > evaluation is not specified.
>
> I think Darren was referring to get() as of a read() function that bumps
> some stream pointer.
Yes, I don't think I contradict to that.
> At any rate, I believe your comment is inaccurate. The
> classic array initialization { expr, expr, expr ... } does not have that
> problem, and is convenient.
Ehm, since we're talking about assignment library, then I surely mean any
intialization syntax *except for classic one*. If we agree the classic one is
OK, then we don't have a problem to solve.
> > of 'for' loop and don't think much about it.
>
> "Nobody knows what most programmers do" -- Bjarne Stroustrup :o)
>
> (The emoticon is mine.)
I know about folks which are phisically around me -- they don't know what
sequence point it.
> Unfortunately, the discussion does not flow the way I had hoped :o). My
> intent is to figure out the opinion of the boost community about the advice
> against overloading the comma, and, and or operators, given by people like
> Scott Meyers and others. Is that a good coding standard or not?
Ok, then my answer to your question is:
- (c), in case everybody knows about sequence points, immediately aware of
unspecified evaluation order everywhere, and use comma to force specific
evaluation order.
- (a), otherwise
- Volodya
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk