ambiguous ?

Henry Spencer henry at utzoo.uucp
Sat Oct 21 17:13:19 AEST 1989


In article <14102 at lanl.gov> jlg at lanl.gov (Jim Giles) writes:
>> [...]Personally, my view is that code which relies on order of evaluation
>> within expressions -- except in a few well-defined cases like C's && and
>> || operators -- is broken even if the language specifies a precise meaning.
>
>Gee, isn't it interesting that the only order dependent behaviour you
>are willing to trust are the "well-defined" && and || operators...

Not really.  All it means is that I think C got this particular decision
right.

>...  Presumably, if C
>made argument evaluation in function calls "well-defined", you would
>would have no qualms depending on their order either...

Your presumption is incorrect.  The whole purpose of && and || is to force
conditional evaluation, and hence evaluation order.  I have no objection
to operators whose specific purpose is to force order, when they are
broadly useful.  I do have considerable objection to code that depends
on evaluation order *without* putting the reader on notice of it by
explicitly using forcing operators.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list