unsafe_convert
unsafe_convert(T,x)
Convert x
to a value of type T
In cases where convert
would need to take a Julia object and turn it into a Ptr
, this function should be used to define and perform that conversion.
Be careful to ensure that a julia reference to x
exists as long as the result of this function will be used. Accordingly, the argument x
to this function should never be an expression, only a variable name or field reference. For example, x=a.b.c
is acceptable, but x=[a,b,c]
is not.
The unsafe
prefix on this function indicates that using the result of this function after the x
argument to this function is no longer accessible to the program may cause undefined behavior, including program corruption or segfaults, at any later time.
Examples
See Also
base, big, bytes2hex, cconvert, complex, convert, dec, hex, hex2bytes, hex2num, oct, oftype, parse, promote, signed, unsafe_convert, unsigned, widen,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.