Boost logo

Boost :

Subject: Re: [boost] Subject: Re: [shared_ptr] Where is the bug?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-10-03 06:56:32


Kasra Nassiri(Math & ComSci) wrote:
> Hi,
>
> Well the bug is in the fact the when you allocated:
> B* b = new X();
>
> You have allocated an int extra, thus when you call:
> delete b;
>
> You are only destructing what was allocated by B

No.
You are invoking undefined behaviour.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk