Quick Question

Martin Weitzel martin at mwtech.UUCP
Thu Aug 9 06:16:11 AEST 1990


In article <10136 at pt.cs.cmu.edu> hjelm at 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 at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.std.c mailing list