|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2004-07-08 14:06:54
From: "Andrei Alexandrescu \(See Website for Email\)" <andrewalex_at_[hidden]>
> "Rob Stewart" <stewart_at_[hidden]> wrote in message
> news:200407072103.i67L3Jk28273_at_tesh.systems.susq.com...
> > From: brangdon_at_[hidden] (Dave Harris)
> > > In-Reply-To: <cch4as$941$1_at_[hidden]>
> > > andrewalex_at_[hidden] (Andrei Alexandrescu \(See Website for Email\))
> > > wrote (abridged):
> > > > I was worried more (only) about the order of evaluation.
> > > >
> > > > v += foo(), bar();
> >
> > Unless I'm mistaken, there is but one sequence point in such an
> > expression, regardless of whether you overload operator,. Thus,
> > any expression using commas must be understood to have
> > indeterminant order of evaluation.
>
> It is exactly such false sense of security and such misunderstandings that
> makes me highly suspicious of overloading the comma operator. Worse,
> comments come that have an apparence of legitimacy. Unless I am even more
> mistaken, your statement above is false. If that's the case, hey, confusion
> is among the inner circle... how about the casual users?
If operator, is overloaded, then there is only one sequence point
in the above expression. If not, then there are two. I forgot
about 1.9/18.
> > Consider:
> >
> > int v[] = { foo(), bar() };
> >
> > Doesn't this exhibit the same problem?
>
> No.
You're right.
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk