🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Continue: static func() const; legal?

#2416
From: linh (l.) dang
Date: Fri, 03 Nov 1995 19:04
46 lines
1909 bytes
Ralph Shnelvar (ralphs@tesser.com) wrote:
: matt@cyclops5.berkeley.edu (Matt Austern) wrote:

: >In article <478k57$5gl@stellar.comnet.com> Bret Pehrson
: ><BretP@strata3d.com> writes:
: >
: >There's no way to declare a function such that it's prohibited from
: >modifying global variables; similarly, there's no way to declare a

Using GCC-xtensions one can write:

void foo() __attribute__ ((const));

foo() then is a function without side-effects. Since class static
variables is a subset of global-variables, a const static member
functions would have no side-effects on this subset.

------------------
L.D.

: >function such that it's prohibited from modifying static member
: >variables.

: That's a double pity.

: First, it is a pity that one cannot declare a function and say "You
: can't access global variables.

: Second, it is a pity that class static variables cannot be defined as
: untouchable.

: Thanks for pointing this counter-intuitive use of
: 	function() const
: out.  I actually had to run a test compilation to believe you.

: Ralph
: ---
: [ 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. ]

---
[ 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: <47dc02$kbh@bmtlh10.bnr.ca>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: "linh (l.) dang" <linhd@bnr.ca>
Newsgroups: comp.std.c++
Subject: Re: Continue:  static func() const;  legal?
Date: 03 Nov 1995 19:04:06 GMT
Organization: Bell Northern Research
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <47dc02$kbh@bmtlh10.bnr.ca>
NNTP-Posting-Host: physics2.berkeley.edu