Re: advpack: Use the FAILED and SUCCEEDED macros instead of comparing to S_OK or zero.
James Hawkins wrote:
- if ((hr = callback(hinf, buffer, arg)) != S_OK) + if (FAILED(hr = callback(hinf, buffer, arg)))
It's usually a bad idea to do function calls or assignments inside macros... in this case it's safe, but sometimes the macro is something like: #define FAILED(hr) (((hr)>0xf00) && (hr)<0xb00)) then the function would get called twice... It's even more fun if you do: FAILED(hr++) Mike
On 5/1/06, Mike McCormack <mike(a)codeweavers.com> wrote:
James Hawkins wrote:
- if ((hr = callback(hinf, buffer, arg)) != S_OK) + if (FAILED(hr = callback(hinf, buffer, arg)))
It's usually a bad idea to do function calls or assignments inside macros... in this case it's safe, but sometimes the macro is something like:
#define FAILED(hr) (((hr)>0xf00) && (hr)<0xb00))
then the function would get called twice...
Would you accept the patch if I put all results into an hr and then called FAILED(hr) instead? -- James Hawkins
participants (2)
-
James Hawkins -
Mike McCormack