On Sat, Mar 28, 2009 at 11:47 AM,  <[email protected]> wrote:
>> var foo = new Foo();
>> var bar = new Bar();
>> bar.somefunc = foo.somefunc;
>> bar.somefunc()
>>
>> segfault! (or at least an error)
>
> Hmm.. but shouldn't a simple check on IsExternal() work out?
> Anyway, my objects can not be constructed so that should be safe,
> at least I hope so :-)

What if Foo and Bar both hold an External at slot 0? Then IsExternal()
will work, External::Cast() will work, but static_cast<Foo*>() won't
work. In my experience, only one internal slot is ever used, so all
bound classes are using slot 0 (i have yet to see a use case which
would be simplified by using more than one slot).

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to