Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.lang.c++ Subject: Re: cfront 2.* mishandles "if (funcname)" statement Message-ID: <58170027@hpclscu.HP.COM> Date: 7 Jun 90 16:52:42 GMT References: <58170025@hpclscu.HP.COM> Organization: Hewlett-Packard Calif. Language Lab Lines: 30 > extern int foo(); > main() > { > if (foo) { > /* ... */ > } > } > > "foo.c", line 4: function != zero I've already received a couple of solicitous messages asking me whether I didn't *really* mean: extern int (*foo)(); And the answer is: NO. I mean what I said. Yes, that check is a constant compile-time check that *must* evaluate to non-zero by definition (if the function is defined somewhere). And I am not feeble-minded: this is not something that I did by accident, nor is it something with a deep inner secret: it is merely a fragment typical of the Plum Hall ANSI C test suite. The worst thing is that cfront gives a HARD error (non-zero exit status), not just a warning (which I could live with - Plum Hall is pretty forgiving of warnings). So back to the language lawyers and the cfront folks in AT&T: what gives? ----- Shankar Unni.