Boost logo

Boost Users :

Subject: Re: [Boost-users] A forward iterator need not be default-constructible
From: Brian Allison (brian.w.allison_at_[hidden])
Date: 2011-09-30 12:21:25


On Fri, Sep 30, 2011 at 12:08 PM, Andrew Sutton <asutton.list_at_[hidden]>wrote:

> > There's nothing in the standard to say that an uninitialized variable
> must
> > be equal to itself.
> >
> > Especially since the standard states that the only defined operation on a
> > singular iterator is ... assignment.
>
> Again, I'm not talking about the standard. I'm talking about basic
> expectations.
>

If your basic expectations do not take the standard into account then your
expectations may lead you to Undefined-Behavior-Land.

>
> > If a clever compiler computed the lifespan of all memory usage, is there
> > anything in the standard which would keep it from using the memory of
> > Singular Iterators as temporary storage? Or randomly bit-twiddling the
> bits
> > in them while they are Singular?
>
> I think any argument that starts with the phrase "If a clever..." is
> automatically suspect. There are lots of clever things that might be
> done, but I wonder at what cost. Would you trust your hypothetical
> compiler to get lifetime right? Do you really want this compiler to
> modify values behind your back?
>
>
Optimizations are clever, and used to be viewed with suspicion.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net