Subj : Re: How to pass boolean value from C++ back to script? (jsapi) To : Christian Biesinger From : Brendan Eich Date : Wed Jan 05 2005 02:16 pm Christian Biesinger wrote: > Jens Bannmann wrote: > >> | JS_ValueToBoolean(cx, jsCheckState, &checkState); > > > I'm thinking JSVAL_TO_BOOLEAN might be faster here... Yes, given the condition guarding this line: | if (JS_GetProperty(cx, jsObject, "value", &jsCheckState) | && JSVAL_IS_BOOLEAN(jsCheckState)) | { | JS_ValueToBoolean(cx, jsCheckState, &checkState); | } | } If you know jsCheckState is of boolean type, then you can just untag it. OTOH, this code owuld be more general if it dropped the JSVAL_IS_BOOLEAN clause and converted non-boolean types via the JS_ValueToBoolean. /be .