Optimizing of explicit temporary storage

Richard Guenther rguenth@tat.physik.uni-tuebingen.de
Sun Oct 10 21:51:00 GMT 2004


Is it legal for a conforming C++ compiler to optimize away storage 
allocation / deallocation?  Like in

#include <new>

void foo(void)
{
         int *x = new(std::nothrow) int;
         delete x;
}

is it allowed to kill the new and delete statements?  Would it be 
allowed to do this for the throwing version of new, too?

Thanks,
Richard.



More information about the Gcc mailing list