www.digitalmars.com         C & C++   DMDScript  

c++ - delete[ ]

reply sevki <mesti_mudam yahoo.com> writes:
hi. mingw's g++ 3.4.5 (i think, the most recent one) gives
0
0
0
7
when i do g++ -O2 -fomit-frame-pointer de.cpp -ode, and doesnt print 9. that's
kind of ok.

when i do dmc de.cpp -o -6 -cpp, or dmc de.cpp -o -6 -cpp -Aa it gives nothing.

is there a problem with dmc in this case, or is it related to some other thing?
begin 644 de.cpp


M" T*8VQA<W, 00T*>PT*"6EN="!A.PT*<'5B;&EC. T*"4$H*3L-" E!*&EN


M/#P



`
end
Oct 06 2006
parent "Matthew" <matthew hat.stlsoft.dot.org> writes:
The program is not well-formed.

The behaviour of

     p = new A(9);
     delete[] p;

is undefined. So any compiler can "legally" do anything it likes with your
"illegal" code.

HTH

Matthew


"sevki" <mesti_mudam yahoo.com> wrote in message
news:eg6882$2jo2$1 digitaldaemon.com...
 hi. mingw's g++ 3.4.5 (i think, the most recent one) gives
 0
 0
 0
 7
 when i do g++ -O2 -fomit-frame-pointer de.cpp -ode, and doesnt print 9.
that's
 kind of ok.

 when i do dmc de.cpp -o -6 -cpp, or dmc de.cpp -o -6 -cpp -Aa it gives
nothing.
 is there a problem with dmc in this case, or is it related to some other
thing?

Oct 06 2006