🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2821

Re: const and typedefs, inconsistent?

#2821
From: Kevin Lentin
Date: Mon, 04 Dec 1995 16:29
24 lines
1889 bytes
Kevin McIsaac (KevinM@lamsys.com) wrote:
> 
>   typedef char* Pc;
>   void f(const Pc);       // void f(char* const)  (not const char*)
>   void g(const int Pc);   // void g(const int)
> 
> May questions are: why the f(const Pc) resolves to char* const? Is the 
> associativity changed? And is it possible to format f(), using Pc, such that 
> it resolves to const char*? TIA.

Because Pc is a pointer to char so const Pc should be a constant pointer to
a char. This is written char* const.
const char* is a pointer to a constant char which is something different.

-- 
[=======================================================================]
[ Kevin Lentin                   |      The Mighty Carlton Blues      | ]
[ K.Lentin@cs.monash.edu.au      |          1995 AFL Premiers         | ]
[ Macintrash: 'Just say NO!'     |CARLTON 21-15-141 d geelong 11-14-80| ]
[=======================================================================]

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <49tsmn$eqc@harbinger.cc.monash.edu.au>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
References: <49ler5$qgu@shadow2.qnetix.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: kevinl@fangorn.cs.monash.edu.au (Kevin Lentin)
Newsgroups: comp.std.c++
Subject: Re: const and typedefs, inconsistent?
Date: 4 Dec 1995 16:29:07 GMT
Organization: Monash University
Approved: clamage@eng.sun.com (comp.std.c++)
Distribution: world
Message-ID: <49tsmn$eqc@harbinger.cc.monash.edu.au>
References: <49ler5$qgu@shadow2.qnetix.ca>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
Content-Transfer-Encoding: 7BIT
To: comp-std-c++@uunet.uu.net
X-Nntp-Posting-User: kevinl
X-Newsreader: TIN [UNIX 1.3 950823BETA PL0]
X-Nntp-Posting-Host: fangorn.cs.monash.edu.au
Content-Length: 940
X-Lines: 20
Originator: clamage@taumet