On 18.12.2013 11:11:10, Richard Braun wrote:
> The expression is ((a == NULL) || a->something), and I agree it is
> equivalent to !((a != NULL) && !a->something). And again, both the
> && and || operators are guaranteed to be evaluated left-to-right and
> *yield* without evaluating the second operand if the first compares
> or not to 0, depending on the operator.
> 
> So, let's take the seconds form since that's what you've used, 
> without the negation for simplicity : ((a != NULL) && !a->something)
> 
> If a isn't NULL, then it returns !a->something. If a is NULL, then
> (a != NULL) compares equal to 0, and && returns 0 before evaluating
> !a->something. So no, there can't be a null pointer dereference here.
> 
> And this really is basic C, so please double check your changes.

Yes, vou're right. I got confused. But then something else is happening 
here. When I write the assertion this way: 

assert((entry == IE_NULL) ||  ((entry != IE_NULL) ? IE_BITS_TYPE
(entry->ie_bits) : TRUE));

GCC stops complaing about uninitialized variable.

Reply via email to