Order of evalution of expressions.

H Bruce elee24 at castle.ed.ac.uk
Wed Sep 19 02:55:09 AEST 1990


I have lost my FAQ files but I'm certain this is not on it....

Is the line

value = *ptr - *ptr++;

sensible C ?
In other words is there a specified order of evaluation of expressions ?
If not then the answer would depend on when the increment is done.

If not what is the fastest way of computing this type of expression ?
Would the following lines be optimized by a compiler (so that value is
not loaded twice) ?

value = *ptr;
value -= *ptr++;


Thanks,

Henry Bruce.



More information about the Comp.lang.c mailing list