🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: class member: static name const; Legal?

#2390
From: Colin Jensen
Date: Wed, 01 Nov 1995 23:58
22 lines
1238 bytes
In article <BASHFORD.95Oct31105612@toad.scripps.edu> bashford@scripps.edu (Don Bashford) writes:
>Thanks Jason, I've wondered about that too.  If you can't mix
>static and const, what way do we have of promising that a static
>member function will not alter static data?  If there is no
>way at the moment, perhaps the standard should provide one.

I think perhaps you think that const member functions cannot modify
static data.  They can.  

The following is permitted:

   class A {
       static int a;
   public:
       void g () const { a++; }
   };

---
[ 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: <199511012305.PAA26591@accom>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <4733v8$278@stellar.comnet.com> <u9n3ainrii.fsf@yorick.cygnus.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: Colin Jensen <cj@accom.com>
Newsgroups: comp.std.c++
Subject: Re: class member: static name const;  Legal?
Date: 01 Nov 1995 23:58:56 GMT
Organization: Accom Inc., Menlo Park, CA
Approved: matt@physics10.Berkeley.EDU (Matt Austern)
Message-ID: <199511012305.PAA26591@accom>
References: <4733v8$278@stellar.comnet.com> <u9n3ainrii.fsf@yorick.cygnus.com>
NNTP-Posting-Host: physics10.berkeley.edu