On Thu, Apr 12, 2012 at 3:24 PM, Michael Schwartz <[email protected]> wrote:

> If you check out the silkjs repository, you'll see I do near zero error
> checking in the C++ code.  So it does crash, just like a C/C++ program will
> if you pass garbage to an OS call (for example).
>

Sorry, i didn't mean to imply that that was explicitly an error, only that
leaving out the IsObject() check "might severely shorten the app's
lifetime."


> However, you can do something like this (which silkjs does do).   Wrap the
> calls to C++ with JavaScript that does the error checking before calling
> the C++ function.
>

That's a fine solution. Nowadays i mostly use C++ templates which validate
the args and dispatch to an appropriate native overload:

http://code.google.com/p/v8-juice/wiki/V8Convert_Overloading

Happy Hacking!

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal

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

Reply via email to