Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re^2: Question on const applied to typedef'd pointer Message-ID: <2105@solo11.cs.vu.nl> Date: 27 Feb 89 19:57:35 GMT References: <9078@elsie.UUCP> <9709@smoke.BRL.MIL> Organization: V.U. Informatica, Amsterdam, the Netherlands Lines: 18 gwyn@smoke.BRL.MIL (Doug Gwyn ) writes: \In article <9078@elsie.UUCP> ado@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@cs.vu.nl, mcvax!botter!maart