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