test-and-dereference: a common problem?

Alexandre Julliard julliard at winehq.org
Mon May 16 11:45:43 CDT 2005


Paul Millar <paul at astro.gla.ac.uk> writes:

> Anyway, I noticed that the dlls/advapi32/crypt.c tests were bombing out
> for me.  This turned out to be due to dlls/advapi32/crypt.c:1649
> 
> > if (!key || !pbData || !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV)
> >     CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER);
> 
> [...]
> So, this makes sense.  Its that old chestnut of compiler being free to
> evaluate if clauses in any order it chooses (for optimisation).

The && and || operators in C are short-circuit operators, meaning they
are always evaluated left to right, and further tests are not executed
if the first ones fail. I'm afraid you wasted your time with that
patch, there's nothing to fix here.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list