sizeof(x): is x ever evaluated?

ccdn at levels.sait.edu.au ccdn at levels.sait.edu.au
Mon Sep 24 00:29:51 AEST 1990


ccdn at levels.sait.edu.au writes:
>       #define _iorc(x) ((sizeof(x)==1)?(unsigned char)(x):(x))
>
> Is sizeof's expression parameter ever executed?  In particular need
> I be concerned about side effects in code like:
>
>       while (_ctype[_iorc(*a++)]);


A more careful reading of K&R does answer this:  "This expression [sizeof]
is semantically an integer constant".  I guess that answers my question.

Sorry for asking foolish questions.


David Newall, who no longer works       Phone:  +61 8 344 2008
for SA Institute of Technology          E-mail: ccdn at lux.sait.edu.au
"Life is uncertain:  Eat dessert first"  *Check the return address!*



More information about the Comp.lang.c mailing list