3.5.4.3, special case parameter declaration

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Oct 18 07:18:36 AEST 1990


In article <3425 at mcrware.UUCP> jejones at mcrware.UUCP (James Jones) writes:
>I just noticed the special case mentioned on lines 2-4 of page 81 of the

Page 69 for most people.

>Standard (section 3.5.4.3) that, if I understand rightly, says that a
>parameter-declaration of the form "(typedef-name)" is to be interpreted
>as if it were "()(typedef-name)".

NO, you've misinterpreted this.

This is simply a kludge to resolve an ambiguity in the declaration
grammar, as exhibited by the following two alternate productions for
any example of the type covered by the wording in question:

	direct-declarator := direct-declarator '(' parameter-type-list ')'
	parameter-type-list := parameter-list
	parameter-list := parameter-declaration
	parameter-declaration := declaration-specifiers declarator [A]
			      OR declaration-specifiers abstract-declarator [B]
	[A] declarator := direct-declarator
	    direct-declarator := '(' declarator ')'
	    declarator := direct-declarator
	    direct-declarator := identifier
	[B] abstract-declarator := direct-abstract-declarator
	    direct-abstract-declarator := '(' parameter-type-list ')'
	    parameter-type-list := parameter-list
	    parameter-list := parameter-declaration
	    parameter-declaration := declaration-specifiers
	    declaration-specifiers := type-specifier
	    type-specifier := typedef-name

>2. Where is the prior art for this context-sensitive interpretation?

This is an inherent problem in the use of abstract-declarator for parameters
in prototypes, which of course K&R 1st Edition C simply did not support.



More information about the Comp.std.c mailing list