Ambiguities

Karl Heuer karl at haddock.ima.isc.com
Thu Sep 13 04:18:51 AEST 1990


In article <862 at gtenmc.UUCP> csp at gtenmc.UUCP (Charudutta S. Palkar) writes:
>Does C mention , which instance of the variable should be used ,
>while evaluating the expression.

No, it's explicitly undefined.  This is intentional.

>If some programmers cannot use its features they might as well
>stop using it.

In this case, they should stop using *those features*, since they are not
actual properties of the language.

There's a tradeoff involved when deciding whether to guarantee such things.
In the case of "&&", it's extremely useful to be able to write things like
"if (p != NULL && isgood(p->thing)) ...", but most people don't care about
"a[i++] = b[i++]" and wouldn't make heavy use of it even if it were
well-defined.  Leaving it explicitly undefined gives the compiler a license
to rearrange the subexpressions for efficiency, which is generally considered
a good thing.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list