Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Evaluation of if's
Message-ID: <1991Jun5.202559.11254@zoo.toronto.edu>
Date: Wed, 5 Jun 1991 20:25:59 GMT
References: <FPB.91Jun4174400@ittc.ittc.wec.com> <1991Jun4.233928.5185@athena.mit.edu> <91156.095107DOCTORJ@SLACVM.SLAC.STANFORD.EDU>
Organization: U of Toronto Zoology

In article <91156.095107DOCTORJ@SLACVM.SLAC.STANFORD.EDU> DOCTORJ@SLACVM.SLAC.STANFORD.EDU (Jon J Thaler) writes:
>>>       if ( (i=1) == (i=2) )
>
>When must a compiler issue warnings or other error messages? It seems to
>me that since this expression is recognizable as an error, a compiler
>'ought' to warn the user.  As far as I can tell, this does not seem to be
>required by the standard.

The problem is that the references to the same variable may be done via
pointers etc., and might be very difficult to recognize at compile time.
So it is not realistic to demand that a compiler diagnose all violations
of this particular rule.

Of course, it is nice if it *does* diagnose them when it notices them.
In general, most any "undefined" item in the standard is something that
a good compiler ought to *try* to notice and report.

The only requirement the standard puts on diagnostics is that a program
which violates the standard's official constraints shall draw at least
one complaint.  Implementations vary so enormously (consider compilers
vs. interpreters, for example) that it was not considered practical to set
any more specific requirements.
-- 
"We're thinking about upgrading from    | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 to SunOS 3.5."              |  henry@zoo.toronto.edu  utzoo!henry
