How to parse this?

Sakari Jalovaara sja at sirius.hut.fi
Wed Jan 23 00:14:34 AEST 1991


> I wish I understood your example..

I meant this:
	/tmp (vipunen) 28> cat t1.c

	typedef char typename;
	int f (int (typename []));
	int f (int func (char arr[]));

	/tmp (vipunen) 29> cc -c t1.c
		4 | int f (int func (char arr[]));
		    ....a.........................
	a - 1506-132: (S) Illegal redeclaration of function, f.
	/tmp (vipunen) 30> cat t2.c

	typedef char typename;
	int f (int (typename []));
	int f (int arr[]);

	/tmp (vipunen) 31> cc -c t2.c
	/tmp (vipunen) 32>

i.e. is "int (typename [])" an abstract declarator or redundant
parenthesis around a declarator.

> What the standard means is that "if an identifier in such contexts
> CAN be taken as a typedef name, then it SHOULD be taken as a typedef name".

Yep, that clears it; the compiler I use above seems to have it wrong.
									++sja



More information about the Comp.lang.c mailing list