Article View: comp.std.c
Article #4069Re: Identifiers in definitions
From: Norman Diamond
Date: Thu, 21 Sep 1995 03:03
Date: Thu, 21 Sep 1995 03:03
42 lines
2448 bytes
2448 bytes
In article <awiner-1909952245190001@awiner-mac2.us.oracle.com>, awiner@oracle.com (Adam Winer) writes:
>Are identifiers in definitions required?
It is impossible to define an identifier without naming the identifier.
Next for your other question:
>That is, is the following code legit:
>int foo(int /* a */, int b);
This declaration of foo is legit. The absence of a declarator for a and
the presence of a declarator for b are both irrelevant.
>int foo(int /* a */, int b) { /* do some stuff, obviously without using a */ }
This definition of foo violates a Constraint, so a diagnostic is required.
In the ANSI Classic edition of the standard it was section 3.7.1, page 83
lines 4 to 6: "If the declarator includes a parameter type list, the
declaration of each parameter shall include an identifier (except for the
special case of a parameter list consisting of a single parameter of type
void, in which there shall not be an identifier)."
>Our compiler [...] admits this without a complaint,
Not in a conforming mode. I don't know if it has a standard conforming mode
or not, but if it does and you want to try it in a conforming mode, do what
the vendor's instructions told you to do.
>and it's very handy for removing unused
>argument warnings in a very explicit manner,
I agree (except of course, that conforming implementations are allowed
to issue spurious false diagnostics as long as they still translate and
execute correct programs, so both the presence and the absence of these
warnings are independent of the standard).
Considering all the nonsense that people are rumored to want to copy
from C++ into C, I wonder why this feature doesn't seem to be included.
--
<< If this were the company's opinion, I would not be allowed to post it. >>
"I paid money for this car, I pay taxes for vehicle registration and a driver's
license, so I can drive in any lane I want, and no innocent victim gets to call
the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
Technical Details
Message-ID:
<43qkm1$d25@usenet.pa.dec.com>Path:
arc1-ca.pugleaf.net!jrd.dec.com!diamondReferences:
<awiner-1909952245190001@awiner-mac2.us.oracle.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!jrd.dec.com!diamond From: diamond@jrd.dec.com (Norman Diamond) Newsgroups: comp.std.c Subject: Re: Identifiers in definitions Date: 21 Sep 1995 03:03:29 GMT Organization: DEC Japan Research and Development Center Distribution: world Message-ID: <43qkm1$d25@usenet.pa.dec.com> References: <awiner-1909952245190001@awiner-mac2.us.oracle.com> NNTP-Posting-Host: jit533.jrd.dec.com