Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!apple!usc!samsung!uunet!mcsun!unido!mikros!mwtech!martin From: martin@mwtech.UUCP (Martin Weitzel) Newsgroups: comp.std.c Subject: Re: Quick Question Keywords: parsing, ansi c Message-ID: <880@mwtech.UUCP> Date: 8 Aug 90 20:16:11 GMT References: <10136@pt.cs.cmu.edu> Reply-To: martin@mwtech.UUCP (Martin Weitzel) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 25 In article <10136@pt.cs.cmu.edu> hjelm@g.gp.cs.cmu.edu (Mark Hjelm) writes: > > >What is the correct parse of: > > int *const *volatile a; > >a is a volatile pointer to a const pointer to an int or >a is a const pointer to a volatile pointer to an int? You can ALLWAYS start with the name of the object (here: a), end with the type (here: int) and simply build your type description by concatenating what you encounter on your way "inside to out". So the first is the correct parsing. Because of this some people even prefer int const x; /* would read: x is a constant int */ over const int x; /* would read: x is an int constant */ Both have the same meaning in ANSI C - the first seems more "logical", but the second is (still) in more widespread use. -- Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83