
"Aaron W. LaFramboise" <aaronrabiddog51@aaronwl.com> wrote in message news:419C1451.9010905@aaronwl.com... | David Abrahams wrote: | | > "Thorsten Ottosen" <nesotto@cs.auc.dk> 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