Safeway to cast Windows CreateFile handle to 'long' and vice versa in C++ -
is safe or correct way cast windows createfile return type ("handle") long datatype , vice versa ie long value handle type? if approach correct how can done in windows 7 environment? 32 bit handling fine portable code handle 64 bit version can best shot.
handle
implemented opaque pointer, casting to/from uintptr_t
shouldn't give problems. but not safe. no conversion implementation-defined datatype integer safe, , no conversion pointer integer safe.
pointers should remain pointers.
implementation-defined types should not converted.
integer should stay integers.
Comments
Post a Comment