home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: Novice question
- Message-ID: <1992Sep8.163541.24845@taumet.com>
- Organization: TauMetric Corporation
- References: <1992Sep1.213224.7550@actrix.gen.nz> <79153@ut-emx.uucp> <1992Sep5.030224.13196@lut.ac.uk>
- Date: Tue, 8 Sep 1992 16:35:41 GMT
- Lines: 24
-
- 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.
-
- It is not legal to assign to "this", and you really DON'T want to do it.
-
- The original version of C++ allowed assignment to "this" to permit a
- class to do its own memory management. This technique was very unsafe,
- and subject to errors that were easy to make but very hard to find.
-
- In 1989, C++ introduced overloading "new" and "delete" to allow a class
- to do its own memory management. This is much safer than the older
- technique. At the same time, assignment to "this" was made obsolescent.
-
- Modern C++ compilers no longer support assignment to "this", since
- there is no valid reason to want to do it. Programmers who want to
- assign to "this" generally have a misunderstanding about what the
- effect would be if it were allowed.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-