Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-28 14:00:13


The problem is what I'd consier a bug in the C++ standard: you are allowed
to call detete on a pointer whose value_type is unknown at the point where
delete is called. In that case, the destructor of the referent is never
called :-(

-Dave

----- Original Message -----
From: "Vladimir Prus" <ghost_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, March 28, 2001 2:59 AM
Subject: [boost] scoped_ptr: trivial dtor?

>
> I don't understand something in scoped_ptr docs. When discussing
handle/body
> idiom, it is said that
>
> This code requires that class body have a trivial destructor to avoid
> undefined behavior.This is because the definition of class body is not
> visible at the time scoped_ptr<> deletes it.
>
> However, I think that "time scoped_ptr<> deletes it" is when dtor for
> scoped_ptr is called, from which I decide that class body may have any
dtor
> if it is defined before *instantination point* of ~scoped_ptr<>. Futher,
one
> can make sure that class that scoped_ptr deletes is complete at deletion
> point by adding dummy "sizeof(T);" statement to dtor. Can anybody clarify
> the matter?
>
> --
> Regards,
> Vladimir
>
> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


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