Re: Signed Hex Values
- Posted by mattlewis (admin) Sep 24, 2013
- 1515 views
petelomax said...
...checking for error using hResult<0 but not having any of the right values to compare against. If instead I... and check for error using and_bits(hResult,#80000000) then (eg) #800704C7 is fine.
Yes, that's how you're supposed to check for errors. It's what I do in EuCOM:
--/topic Errors --/func is_error( atom hresult ) --/ret Boolean: 1 if error, 0 if not error --Typically, an hresult (the standard return value from a COM function call) will --be 0 if no error, and non-zero if an error occurs. However, there are some values that --are non-zero that are 'qualified' successes. Critical errors, as they are called, can --be detected by using a mask of #80000000, which is what this funcion does. public function is_error( atom hresult ) return and_bits( hresult, #80000000 ) end function
Matt