Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-11-18 10:43:33


"Aaron W. LaFramboise" <aaronrabiddog51_at_[hidden]> wrote in message
news:419C1451.9010905_at_aaronwl.com...
| David Abrahams wrote:
|
| > "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
|
| >>Here's my take on it: a compiler is allowed to a remove any copy
operations as
| >>long as the programs observed behavior is the
| >>same. AFAICT, copying (or assigning) a vector<int> (compared to not doing
it)
| >>will never change the observed behavior.
| >
| > You're kidding, right?

I wasn't :-)

| > I doubt very much that the compiler can
| > legitimately decide that side effects on the memory subsystem due to
| > allocation are not observable.
|
| This came up on the GCC lists a while back
| <http://gcc.gnu.org/ml/gcc/2004-10/msg00424.html>.

Reading through that thread, I think must be dependent on how we define
"observable behavior". Including the
memory system as observable is wierd IMO...just the fact that there are no
other portable guarantees of memory layout/memory manager
suggest that making 2 instead of 1 heap-allocations cannot be what we mean by
observable.

So the example from the gcc-thread,

free(malloc(15));

should easily be allowed to be removed.

-Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk