Re: Phix: 64bit (-1) equal #ffffffffffffffff ?!
- Posted by andreasWagner in February
- 364 views
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
thanks for the answer, now at least i feel a little better and no longer doubt my sanity so much. And I can understand that you don't want to change anything. But with Raymond Chen on your side, who is to say that the solution is worse than any other? The ("or #FFFFFFFFFF") is a very good idea before the next surprise comes.
Thank you