Newsgroups: comp.std.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Volatile binding for const? Message-ID: <1989Mar29.210035.4085@utzoo.uucp> Organization: U of Toronto Zoology References: Date: Wed, 29 Mar 89 21:00:35 GMT In article pardo@uw-june.stars.flab.Fujitsu.JUNET (David Keppel) writes: > char const *s, *t; =is=> {char const *} s, t > char *const s, *t; =is=> char {const *s}, *t > >The second one makes sense to me. The first one doesn't. Is this >behavior correct? Yes. "char const" in the first declaration is exactly the same as "const char" -- the "const" is part of the 'basic' type, not the declarators for the individual variables. In the second one, the "const" is part of the declarator. The first one declares "s" to be pointer to const char. The second one declares "s" to be const pointer to char. (Both declare "t" to be pointer to const char.) There are two places where "const" may appear -- as part of the 'basic' type, and as part of a declarator (AFTER the "*"), and the meanings are different. Few will dispute that the syntax is revolting, even for C. -- Welcome to Mars! Your | Henry Spencer at U of Toronto Zoology passport and visa, comrade? | uunet!attcan!utzoo!henry henry@zoo.toronto.edu