The use of a zero flag
rolf.kalbermatter at citeng.com
Thu Jan 13 03:56:29 CST 2005
Paul Vriens wrote:
>a few days ago I found a bug in ole32/compobj.c where we did something
>if ( foo & FLAG) .... where FLAG=0
>This 'inspired' me to check for more of these kind of checks.
>One that I already found is in dlls/dplayx/dplay.c
>We are checking for DPSET_REMOTE (which is zero) where we should have
>checked for !DPSET_LOCAL or something alike.
Often flag sets with a zero flag are more like an enumeration than real
flags and have some sort of mask defined which specifies which bits are
relevant for that group of flags.
Microsoft does something mix real flags and enumeration flags in the same
integer but always at different bit locations.
if ((foo & MASK) == FLAG)
will usually work fine then.
More information about the wine-devel