🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5838

Re: Volatile binding for const?

#5838
From: Doug Gwyn
Date: Wed, 29 Mar 1989 16:06
18 lines
1501 bytes
In article <PARDO.89Mar28105228@uw-june.stars.flab.Fujitsu.JUNET> pardo@uw-june.stars.flab.Fujitsu.JUNET (David Keppel) writes:
>I'm confused about the proper binding for the `const' and `volatile'
>keywords.  Both of my `pANS conformant' (:-) compilers tell me
>something about storage qualifiers that I find counter-intuitive.
>	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?  Is there a rationalle that would help my
>intuition get a little closer to reality?

Perhaps it will help to observe that `s' has a different type in the
two cases.  In the first case it is a pointer to a const char, while
in the second case it is a const pointer to a char.

Thus, "const" in the first case applies to "char" in effect, and is
thus part of the types for both `s' and `t'.  In the second case,
"const" applies to the "*" associated with `s' but not to the "*"
associated with `t'.
Technical Details
Message-ID: <9943@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!haven!adm!smoke!gwyn
References: <PARDO.89Mar28105228@uw-june.stars.flab.Fujitsu.JUNET>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!ames!haven!adm!smoke!gwyn
From: gwyn@smoke.BRL.MIL (Doug Gwyn )
Newsgroups: comp.std.c
Subject: Re: Volatile binding for const?
Message-ID: <9943@smoke.BRL.MIL>
Date: 29 Mar 89 16:06:15 GMT
References: <PARDO.89Mar28105228@uw-june.stars.flab.Fujitsu.JUNET>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 18