Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!decvax!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Question on const applied to typedef'd pointer Message-ID: <11917@haddock.ima.isc.com> Date: 1 Mar 89 23:12:20 GMT References: <9078@elsie.UUCP> <9709@smoke.BRL.MIL> <2105@solo11.cs.vu.nl> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 18 In article <2105@solo11.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >gwyn@smoke.BRL.MIL (Doug Gwyn ) writes: >>In article <9078@elsie.UUCP> ado@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@haddock.isc.com), The Walking Lint