Question on const applied to typedef'd pointer

Karl Heuer karl at haddock.ima.isc.com
Thu Mar 2 09:12:20 AEST 1989


In article <2105 at solo11.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>gwyn at smoke.BRL.MIL (Doug Gwyn ) writes:
>>In article <9078 at elsie.UUCP> ado at elsie.UUCP (Arthur David Olson) writes:
>>>	typedef char *		bar;
>>>	const bar const		baz;
>>No; you can't slip a qualifier "inside" an existing typedef.
>>[That attempt] is the same as
>>	char * const const	foo;
>
>Why? I find this illogical.

Let me restate with a different example.  After `typedef char *string',
`string const x' means `char * const x' rather than `char const * x'.  Do you
still find this illogical?  In my opinion, this is true for essentially the
same reason that `string x, y' means `char *x, *y' rather than `char *x, y'.
Once you've created the typedef, it's set in stone.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list