Article View: comp.std.c
Article #5701Re: "a();" not a valid external declaration in pANS C.
From: Joe Buck
Date: Mon, 06 Feb 1989 17:51
Date: Mon, 06 Feb 1989 17:51
21 lines
1351 bytes
1351 bytes
In article <46@microsoft.UUCP> jangr@microsoft.UUCP (Jan Gray) writes:
>pANS C accepts "int a();" and "a() {}" but not "a();", which is valid K&R C.
>I am curious about the rationale behind this change. Was it "nobody really
>uses that construct, and banning it simplifies the grammar"?
Not only does nobody use that construct intentionally, but I've seen
problems arise because of typos because of this construct. I had a
coworker make an error roughly equivalent to
double x, y; func();
(typing a semicolon instead of a comma) which has the effect of
declaring func to return an integer (this is easy to do when you add
an extra variable or function to a declaration). Under ANSI rules an
error is reported and the problem is corrected.
--
- Joe Buck jbuck@epimass.epi.com, or uunet!epimass.epi.com!jbuck,
or jbuck%epimass.epi.com@uunet.uu.net for old Arpa sites
Life is not a dress rehearsal.
Technical Details
Message-ID:
<2856@epimass.EPI.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!tymix!epimass!jbuckReferences:
<46@microsoft.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!tymix!epimass!jbuck From: jbuck@epimass.EPI.COM (Joe Buck) Newsgroups: comp.std.c Subject: Re: "a();" not a valid external declaration in pANS C. Message-ID: <2856@epimass.EPI.COM> Date: 6 Feb 89 17:51:32 GMT References: <46@microsoft.UUCP> Reply-To: jbuck@epimass.EPI.COM (Joe Buck) Organization: Entropic Processing, Inc., Cupertino, CA Lines: 21