Must useless expressions be evaluated?

Sam Kendall kendall at wjh12.UUCP
Sat Oct 15 18:52:56 AEST 1983


                I think useless expressions must be evaluated, simply because
        there is no syntactic criterion to determine the uselessness of any
        expression.  For example,
		(i=j)+something()+k++;
	is not syntactically different from
		(i=j)+1+k++;
	but something() probably has side effects.

Well, `something()' is a function call, and `1' isn't.

Some (syntactic) operators may have side effects, and others never do.  If
the result of one of the former isn't used, it must still be evaluated.  If
the result of one of the latter isn't used, there is no reason to evaluate
it.  Please, let's drop this topic.

	Sam Kendall		  {allegra,ihnp4}!wjh12!kendall
	Delft Consulting Corp.	    decvax!genrad!wjh12!kendall



More information about the Comp.lang.c mailing list