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(VEF9&5F(%]?1$U#7U\-"B-I;F-L=61E/&EO<W1R96%M+F ^#0HC96QS90T*
M(VEN8VQU9&4\:6]S=')E86T^#0IU<VEN9R!S=&0Z.F-O=70[#0HC96YD:68-
M" T*8VQA<W, 00T*>PT*"6EN="!A.PT*<'5B;&EC. T*"4$H*3L-" E!*&EN
M="D[#0H)?D$H*3L-"GT[#0H-"D$Z.D$H*0T*>PT*"6$],#L-"GT-" T*03HZ
M02AI;G0 86$I#0I[#0H)83UA83L-"GT-" T*03HZ?D$H*0T*>PT*"6-O=70 
M/#P 82`\/"`G7&XG.PT*?0T*#0II;G0 ;6%I;B I#0I[#0H)02`J<"`](&YE
M=R!!.PT*"61E;&5T92!P.PT*#0H)<"`](&YE=R!!6S)=.PT*"61E;&5T95M=
M('`[#0H-" EP(#T ;F5W($$H-RD[#0H)9&5L971E('`[#0H-" EP(#T ;F5W
G($$H.2D[#0H)9&5L971E6UT <#L-" T*"7)E='5R;B`P.PT*?0T*
`
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