home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13238 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.7 KB  |  65 lines

  1. Path: sparky!uunet!olivea!hal.com!decwrl!access.usask.ca!skorpio!srikant
  2. From: srikant@skorpio.usask.ca (Srikant Subramaniam)
  3. Newsgroups: comp.lang.c++
  4. Subject: What is "this" ...
  5. Message-ID: <1992Sep2.233813.1866@access.usask.ca>
  6. Date: 2 Sep 92 23:38:13 GMT
  7. Sender: srikant@skorpio (Srikant Subramaniam)
  8. Organization: University of Saskatchewan, Saskatoon, Canada
  9. Lines: 53
  10. Nntp-Posting-Host: skorpio.usask.ca
  11.  
  12. Hello Netters:
  13.  
  14. Could somebody out there help me find a solution ??
  15.  
  16.  
  17.     Class Chore {
  18.     ....
  19.     public: 
  20.         Chore () { .....};
  21.         ...
  22.         dec_reference_count() {
  23.              lock_reference_count();
  24.                     num_possible_waiters--;
  25.  
  26.                     if ((num_possible_waiters <= 0) && !worker_reference){
  27.                             unlock_reference_count();
  28.                             delete this;        // offending line
  29.                     }
  30.                     else {
  31.                             unlock_reference_count();
  32.                     }
  33.             }
  34.  
  35. File TC_Program.c
  36. ---------------
  37.  
  38.  
  39.     Chore* userchore = new Chore (.........);
  40.     userchore->dec_reference_count();        // this is line #65
  41.     .........
  42.     
  43. So far so good, now comes the problem:
  44.  
  45. When I compile the above code, the compiler flags this error :
  46.  
  47.     accom: Error: TC_Program.c, line 65: left operand is void
  48.  
  49. I have located the problem to lie in the line labelled "offending line". When
  50. this line is commented out, the compilation goes thru. Could somebody pl tell
  51. me what is wrong ?
  52.  
  53. Thanks ...
  54. -- 
  55. ----- 
  56.  |\/\/\/|      Srikant Subramaniam.
  57.  |      |      srikant@cs.usask.ca 
  58.  |    |
  59.  |      |      Disclaimer: This is not what really I look like.     
  60.  | (o)(o)      Disclaimer: I didn't do it, nobody saw me do it, 
  61.  C      _)                  can't prove anything. 
  62.   | ,___|             
  63.   |   /     
  64.   /---\    
  65.