Question on const applied to typedef'd pointer

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Feb 25 15:25:01 AEST 1989


In article <9078 at elsie.UUCP> ado at elsie.UUCP (Arthur David Olson) writes:
>1>	const char * const	foo;
>	typedef char *		bar;
>2>	const bar const		baz;
>The question for the gurus:  should line 1 above have the same meaning as
>line 2 above, despite gcc's warning?

No; you can't slip a qualifier "inside" an existing typedef.
GCC is correct; both "consts" apply at the same lexical level,
namely to the "bar" type.  The line tagged "2>" above is the
same as
	char * const const	foo;



More information about the Comp.lang.c mailing list