True disposable objects (add "Finalized!" assertion)
Steven Schveighoffer
schveiguy at yahoo.com
Mon May 7 04:44:54 PDT 2012
On Sat, 05 May 2012 17:12:14 -0400, Simen Kjaeraas
<simen.kjaras at gmail.com> wrote:
> On Fri, 04 May 2012 21:07:20 +0200, Steven Schveighoffer
> <schveiguy at yahoo.com> wrote:
>
>> On Fri, 04 May 2012 14:50:06 -0400, Simen Kjaeraas
>> <simen.kjaras at gmail.com> wrote:
>>
>>> I believe the idea was that it'd blow up if you use it unwisely. clear
>>> might
>>> do that, but if you're unlucky, it'll 'work' just fine, giving you
>>> problems
>>> later.
>>
>> clear zeros out the vtable, so it's highly unlikely it "just works".
>
> Final functions still work, as they don't need the vtable.
Just thought of this:
Object.invariant uses the vtable I believe, so unless you only ever test
in release mode, you will crash on every method call.
-Steve
More information about the Digitalmars-d
mailing list