Re^2: Question on const applied to typedef'd pointer

Maarten Litmaath maart at cs.vu.nl
Tue Feb 28 05:57:35 AEST 1989


gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
\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;

Why? I find this illogical. Else how could one obtain what Arthur intended?
-- 
 "Those who do not understand Henry     |Maarten Litmaath @ VU Amsterdam:
Spencer are condemned to reinvent DOS." |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.lang.c mailing list