Article View: comp.std.c
Article #4004Function-prototype scope: Why?
From: Paul Long
Date: Fri, 15 Sep 1995 18:29
Date: Fri, 15 Sep 1995 18:29
26 lines
1691 bytes
1691 bytes
This is something I've wondered about. Why does function-prototype scope exist?
Does anyone take advantage of it? I doubt whether anyone other than compiler
writers even knows that it exists.
I am NOT proposing that function-prototype scope be removed from the Standard,
but for sake of discussion, why couldn't something like these constraints take
the place of the description of function-prototype scope in the Standard:
A function parameter shall not declare a new type (i.e., a new
structure, union, or enumerated type).
The identifier of a function-parameter declarator shall not be
referenced except within the function being defined.
These constraints would render the following non-conforming.
void foo(struct S { int a; }, struct S *, int i, int a[sizeof i]);
Is function-prototype scope provided for completeness? Would it have been more
confusing to preclude it? What gives?
--
Paul Long 45:29:14N 122:48:09W
plong@perf.com http://www.teleport.com/~pciwww/
"Where time or intelligence are lacking, a goto may do the job."
- M.E. Hopkins, "A Case for the GOTO," 1972.
Technical Details
Message-ID:
<43cgmb$cec@news0.rain.rg.net>Path:
arc1-ca.pugleaf.net!usenet.eel.ufl.edu!pacifier!rainrgnews0!usenetShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!usenet.eel.ufl.edu!pacifier!rainrgnews0!usenet From: Paul Long <plong@perf.com> Newsgroups: comp.std.c Subject: Function-prototype scope: Why? Date: 15 Sep 1995 18:29:31 GMT Organization: Performance Computing Incorporated Message-ID: <43cgmb$cec@news0.rain.rg.net> NNTP-Posting-Host: yosemite.perf.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.1 sun4c) X-URL: news:comp.std.c