>From here http://bespin.cz/~ondras/html/classv8_1_1String_1_1Utf8Value.html:

Converts an object to a UTF-8-encoded character array. Useful if you want 
> to print the object. If conversion to a string fails (e.g. due to an 
> exception in the toString() method of the object) then the length() method 
> returns 0 and the * operator returns NULL.
>

I'm not a C++ developer but as far as I understand it returns a null 
pointer if it fails.

If we do:

String::Utf8Value s (String::New ("asdasd"));


s can be null if it fails. If this is true then why in the source code they 
don't check for null? Examples: 
L102<https://github.com/joyent/node/blob/2944e03/src/node_child_process.cc#L102>,
 
L116<https://github.com/joyent/node/blob/2944e03/src/node_child_process.cc#L116>,
 
etc

---

If you look to the above links you can see that after converting the string 
they call to strdup() and when they finish with it then they free() it. 
Why? Is it necessary?

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to