consistency in declaration

Jim Gardner jagardner at watmath.waterloo.edu
Sun Jun 18 19:41:26 AEST 1989


In article <14544 at watdragon.waterloo.edu> jyegiguere at lion.waterloo.edu (Eric Giguere) writes:
>In article <13732 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>>it.  I'd say it's a compiler bug.
>
>Compiler bug?  The specific phrasing in the pANS is
>
>    "A parameter type list specifies the types of, and may declare
>     identifiers for, the parameters of the function." (3.5.4.3)
>
>As Karl says, this does not in fact disallow the case above.  Nor does it
>allow it... it's ambiguous.  Personally I prefer the approach that a
>prototype either declares identifiers for all the parameters or leaves them
>all out.  I really can't see any reason for the inconsistent notation.

The phrase you quote does not impose any restrictions. The grammar given in
the standard allows mixing. Unless there's some constraint elsewhere in the
standard, it seems clear that mixing is allowed. By imposing the restriction,
you are demanding that every writer of a portable ANSI conforming program
come to the same conclusion as you, and personally impose the same
restriction. I say your compiler's broken.

(I'm not defending the mixing of parameter declaration identifiers. It seems
silly, but macros and automatic code generators can result in silly, but
correct, code. <- is that an oxymoron?)
>
>In any case that's the way we've implemented it in Waterloo C.  Apparently
>that's the way Microsoft does it as well... Watcom C probably does it that
>way too.... but I suppose we're quibbling over very minor details.  Let's
>get back to trigraphs :-)

Just to confuse the world, the University of Waterloo C compiler allows you
to mix the declarations. (the GCOS8 one, probably the PC and Port ones too)

David Tanguay



More information about the Comp.lang.c mailing list