🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: relaxing const match on function implementation

#2298
From: John Max Skaller
Date: Wed, 25 Oct 1995 05:34
47 lines
1848 bytes
Alan Griffiths <aGriffiths@ma.ccngroup.com> wrote:
>In the interests of hiding implemetation details it seems to me that 
>a function that does not amend an object passed as a formal parameter 
>should be able to declare that parameter as "const" without requiring
>the same of a function prototype.
>
>For example:
>
>void f(int a);   // prototype in a shared header file.
>void f(const int a) {}  // Implementation of above.

   You are correct. This IS the case in ISO C. It also IS
the case in C++ now. In particular the declarations:

   void f(int);
   void f(int const);
   void f(const int);

declare the same function.
   

>This should not break any existing code.

    It can, but too bad -- it IS the status quo now in C++
and always was in ISO C.

>Is this a good idea, or am I missing something?

    I voted in favour of the change to the ARM to bring
C++ into line with ISO C so I guess I think it
is a good idea. :-)


-- 
John Max Skaller               voice: 61-2-566-2189
81 Glebe Point Rd              fax:   61-2-660-0850
GLEBE NSW 2037                 email: maxtal@suphys.physics.oz.au
AUSTRALIA                      email: skaller@maxtal.com.au




---
[ 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: <46kdsh$b1v@oznet07.ozemail.com.au>
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
References: <814452107snz@ma.ccngroup.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
From: John Max Skaller <maxtal@suphys.physics.su.oz.au>
Newsgroups: comp.std.c++
Subject: Re: relaxing const match on function implementation
Date: 25 Oct 1995 05:34:10 GMT
Organization: MAXTAL
Approved: Matt@Austern
Message-ID: <46kdsh$b1v@oznet07.ozemail.com.au>
References: <814452107snz@ma.ccngroup.com>
NNTP-Posting-Host: austern.hip.berkeley.edu