[clug] Code question: Why doesn't this seqfault (kernel/printk.c)

Damien Elmes clug at repose.cx
Mon Oct 20 12:40:17 EST 2003


Darren Freeman <daz111 at rsphysse.anu.edu.au> writes:

> only if gcc decides to execute left-to-right when testing expressions.
>
> IIRC there is no guarantee in C that this is the case, although it's
> often true.

Are you sure?

There is a a lot of code out there like the following:

if (mystruct && mystruct->var)

I was under the impression that the order of evaluation was not
ambiguous.

Regards,
-- 
Damien Elmes



More information about the linux mailing list