Re: Phix: 64bit (-1) equal #ffffffffffffffff ?!
- Posted by petelomax in February
- 373 views
if equal(fn_val,#ffffffffffffffff) then -- fn_val=-1 --This helps with Phix 64bit, but i think it is an ugly hack, end if
I'll agree with you that is not pretty, but it is probably the best/safest way, and (esp with an "or #FFFFFFFF") protects you against the sign of c_func() results possibly getting flipped one day.
Of course, having got it to work at all, I am going to be exceeding cautious of making the slightest change to anything in that area, for fear of it all coming crashing down like a ton of bricks.
Should you think I have some special knowledge of whether INVALID_FILE_HANDLE is -1, #FFFFFFFF, #FFFFFFFFFFFFFFFF, (HANDLE)-1, (HANDLE)(LONG_PTR)-1, (1 << FFI::Platform::ADDRESS_SIZE) - 1, or something else entirely, you would be quite wrong. Even Raymond Chen, the oracle of all microsoft-related knowledge, has some disparaging words to say on the matter, NULL would have been better, but "it is what it is, and we cannot change history": https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443