home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!hal.com!decwrl!access.usask.ca!skorpio!srikant
- From: srikant@skorpio.usask.ca (Srikant Subramaniam)
- Newsgroups: comp.lang.c++
- Subject: What is "this" ...
- Message-ID: <1992Sep2.233813.1866@access.usask.ca>
- Date: 2 Sep 92 23:38:13 GMT
- Sender: srikant@skorpio (Srikant Subramaniam)
- Organization: University of Saskatchewan, Saskatoon, Canada
- Lines: 53
- Nntp-Posting-Host: skorpio.usask.ca
-
- Hello Netters:
-
- Could somebody out there help me find a solution ??
-
-
- Class Chore {
- ....
- public:
- Chore () { .....};
- ...
- dec_reference_count() {
- lock_reference_count();
- num_possible_waiters--;
-
- if ((num_possible_waiters <= 0) && !worker_reference){
- unlock_reference_count();
- delete this; // offending line
- }
- else {
- unlock_reference_count();
- }
- }
-
- File TC_Program.c
- ---------------
-
-
- Chore* userchore = new Chore (.........);
- userchore->dec_reference_count(); // this is line #65
- .........
-
- So far so good, now comes the problem:
-
- When I compile the above code, the compiler flags this error :
-
- accom: Error: TC_Program.c, line 65: left operand is void
-
- I have located the problem to lie in the line labelled "offending line". When
- this line is commented out, the compilation goes thru. Could somebody pl tell
- me what is wrong ?
-
- Thanks ...
- --
- -----
- |\/\/\/| Srikant Subramaniam.
- | | srikant@cs.usask.ca
- | |
- | | Disclaimer: This is not what really I look like.
- | (o)(o) Disclaimer: I didn't do it, nobody saw me do it,
- C _) can't prove anything.
- | ,___|
- | /
- /---\
-