Jsctypes/api: Difference between revisions

Jump to navigation Jump to search
249 bytes removed ,  20 October 2009
→‎Conversions: kill the voidptr_t("0x0123456789abcdef") ExplicitConvert case
(Remove the string types. Auto-convert from JS strings to C/C++ array-of-char types, but not vice versa.)
(→‎Conversions: kill the voidptr_t("0x0123456789abcdef") ExplicitConvert case)
Line 462: Line 462:
* If ''t'' is a pointer type and ''val'' is a number, <code>Int64</code> object, or <code>UInt64</code> object that can be exactly represented as an <code>intptr_t</code> or <code>uintptr_t</code>, the result is the same as casting that <code>intptr_t</code> or <code>uintptr_t</code> value to type ''t'' with a C-style cast.
* If ''t'' is a pointer type and ''val'' is a number, <code>Int64</code> object, or <code>UInt64</code> object that can be exactly represented as an <code>intptr_t</code> or <code>uintptr_t</code>, the result is the same as casting that <code>intptr_t</code> or <code>uintptr_t</code> value to type ''t'' with a C-style cast.


* If ''t'' is a pointer type, pointer-sized type, or 64-bit type, and ''val'' is a string consisting entirely of an optional minus sign, followed by the characters "0x" or "0X", followed by one or more hexadecimal digits, then the result is the same as casting the number named by ''val'' to type ''t'' with a C-style cast. ''(Open issue: The conversion from string to pointer is very likely to be dropped. It would collide with auto-converting strings to pointer types like <code>char.ptr</code>, and the workaround is pretty straightforward:  <code>''t''(''val'') &rarr; ''t''(uintptr_t(''val''))</code>.)''
* If ''t'' is a pointer-sized or 64-bit integer type, <code>long</code>, or <code>unsigned long</code>, and ''val'' is a string consisting entirely of an optional minus sign, followed by the characters "0x" or "0X", followed by one or more hexadecimal digits, then the result is the same as casting the number named by ''val'' to type ''t'' with a C-style cast.


* Otherwise fail.
* Otherwise fail.
638

edits

Navigation menu