This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: c++/770: Memory allocated by new remains accessible even after calling delete.


Tathagato.Rai.Dastidar@nsc.com wrote:-

> After some time, it is destroyed by calling delete. However,
> data members of the class are still accessible via member
> functions (called on the deallocated pointer).

You've been lucky, then.

> Trying to access deallocated memory should give a core dump.

No, it's undefined behaviour.

> Nothing of the sort happens. The program runs normally.

This is not a bug; you just happen to have been lucky.  I bet if you
had the same line at other places in a program it would core dump.

I've closed the GNATS entry.

Neil.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]