www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - delete[ ]

↑ ↓ ← 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?
Oct 06 2006
↑ ↓ → "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.

 kind of ok.

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

 is there a problem with dmc in this case, or is it related to some other


Oct 06 2006