Article View: gnu.g++.bug
Article #535G++ 1.36 problem?
From: Mike Thome
Date: Mon, 16 Oct 1989 19:59
Date: Mon, 16 Oct 1989 19:59
22 lines
1059 bytes
1059 bytes
Now that I've got g++ working here (thanks those who responded to my
earlier plea for help), I've got another problem...
The following code fragment (from InterViews):
class Resource {
public:
Resource () { refcount = 1; }
~Resource () { if (--refcount > 0) { this = 0; } }
void Reference () { ++refcount; }
int LastRef () { return refcount == 1; }
private:
unsigned refcount;
};
Generates the following error message:
foo.c: In method Resource::~Resource ():
foo.c:4: assignment of read-only parameter `$this'
As far as I can tell from Stroustrup, this appears to be a perfectly
valid use of THIS in a destructer. What's going on here?
-mik (mthome@bbn.com, mthome@thalamus.bu.edu)
Technical Details
Message-ID:
<46991@bbn.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!bbn!bbn.com!mthomeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!bbn!bbn.com!mthome From: mthome@bbn.com (Mike Thome) Newsgroups: gnu.g++.bug Subject: G++ 1.36 problem? Message-ID: <46991@bbn.COM> Date: 16 Oct 89 19:59:24 GMT Sender: news@bbn.COM Lines: 22