Boost logo

Boost :

From: Andrei Alexandrescu \(See Website for Email\) (andrewalex_at_[hidden])
Date: 2004-07-08 12:38:30

"Vladimir Prus" <ghost_at_[hidden]> wrote in message
> Darren Cook wrote:
> > > No. This is a common misconception and a common source of bugs that
> > > show up when optimizations are turned on. It's also a source of
> > > exception-unsafe code, as detailed in Exceptional C++ and a GOTW
> >
> > That kind of validates using v+=foo(),bar(); then, but also says why you
> > shouldn't use it: a common source of bugs.
> >
> > I think with an initialization library in particular people will write,
> > 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
> have this problem just becase you'd have single expression, and the order
> evaluation is not specified.

I think Darren was referring to get() as of a read() function that bumps
some stream pointer. At any rate, I believe your comment is inaccurate. The
classic array initialization { expr, expr, expr ... } does not have that
problem, and is convenient.

> So, the question is whether use of "," above makes user think that the
> of evaluation is specified? I think it does not matter. Most users don't
> about sequence points and operator,. The mostly use operator,() inside
> of 'for' loop and don't think much about it.

"Nobody knows what most programmers do" -- Bjarne Stroustrup :o)

(The emoticon is mine.)

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?


Boost list run by bdawes at, gregod at, cpdaniel at, john at