October 06, 2006 delete[ ] | ||||
|---|---|---|---|---|
| ||||
Attachments: | 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? | |||
October 06, 2006 Re: delete[ ] | ||||
|---|---|---|---|---|
| ||||
Posted in reply to sevki | 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?
>
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply