home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13408 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.5 KB

  1. Path: sparky!uunet!igor!thor!rmartin
  2. From: rmartin@thor.Rational.COM (Bob Martin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Novice question
  5. Message-ID: <rmartin.715994007@thor>
  6. Date: 8 Sep 92 23:13:27 GMT
  7. References: <1992Sep1.213224.7550@actrix.gen.nz> <79153@ut-emx.uucp> <1992Sep5.030224.13196@lut.ac.uk>
  8. Sender: news@Rational.COM
  9. Lines: 29
  10.  
  11. J.March@lut.ac.uk writes:
  12.  
  13. |I'm getting quite few "warning: assignment to this (anachronism)" messages
  14. |from my compiler.  I do actually want to do this, so how do I let my
  15. |compiler know that I *really* mean it.
  16.  
  17. I am not sure that you do.  Assigning to 'this' is an old facility of
  18. the language which will disappear in the next release or so.  It used
  19. to be used as a way to allow a constructor to allocate it's own
  20. memory.  It was made an anachonism when operator new was added to the
  21. language.
  22.  
  23. So, do you really mean it?  If you do, then you must live with the
  24. warning, and you must live with the fact that later compilers will not
  25. support it.
  26.  
  27. |By declaring "this" to be a *const, is "this" effectively being passed by 
  28. |reference?  Thinking of the semantics here.
  29.  
  30. In C++ terms, 'this' is a pointer.  In more general terms, you could
  31. say that 'this' was "self" passed by reference....  6 of one...
  32.  
  33.  
  34. |Jon March
  35. --
  36. Robert Martin                        Training courses offered in:
  37. R. C. M. Consulting                       Object Oriented Analysis
  38. 2080 Cranbrook Rd.                        Object Oriented Design
  39. Green Oaks, Il 60048 (708) 918-1004       C++
  40.