Funny mistake

Doug Gwyn gwyn at smoke.brl.mil
Sun Mar 17 08:30:05 AEST 1991


In article <1991Mar16.195153.15509 at murdoch.acc.Virginia.EDU> gsh7w at astsun.astro.Virginia.EDU (Greg Hennessy) writes:
-#>>"if (a = b)" instead of "if (a == b)". 
-#>... I have yet to see a UNIX compiler complain about it
-Doug Gwyn:
-#That's good, because it is valid C and the compiler cannot know whether
-#or not it reflects the programmer's intentions.
-Then perhaps that is why having an optional flag to inform the user of
-this sometimes suspicious code fragment may be a good idea.

In the world of UNIX, we normally rely on "lint" to generate warnings
about *possible* problems like this.  The compilers are expected to
accept conforming translation units and silently translate them.



More information about the Comp.lang.c mailing list