🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5835

Re: Volatile binding for const?

#5835
From: Henry Spencer
Date: Wed, 29 Mar 1989 21:00
21 lines
1420 bytes
In article <PARDO.89Mar28105228@uw-june.stars.flab.Fujitsu.JUNET> 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
Technical Details
Message-ID: <1989Mar29.210035.4085@utzoo.uucp>
Path: arc1-ca.pugleaf.net!utzoo!henry
References: <PARDO.89Mar28105228@uw-june.stars.flab.Fujitsu.JUNET>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!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: <PARDO.89Mar28105228@uw-june.stars.flab.Fujitsu.JUNET>
Date: Wed, 29 Mar 89 21:00:35 GMT