home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19717 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.7 KB

  1. Path: sparky!uunet!cs.utexas.edu!geraldo.cc.utexas.edu!emx.cc.utexas.edu!not-for-mail
  2. From: jamshid@emx.cc.utexas.edu (Jamshid Afshar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: is 'this' obsolete??!!
  5. Date: 21 Jan 1993 19:29:06 -0600
  6. Organization: The University of Texas at Austin, Austin, Texas
  7. Lines: 23
  8. Message-ID: <1jnil2INNcsg@emx.cc.utexas.edu>
  9. References: <1993Jan21.181219.25491@ugle.unit.no> <C189y5.36n@inews.Intel.COM>
  10. NNTP-Posting-Host: emx.cc.utexas.edu
  11. Summary: BC++ documentation error.  Should say "assignment to this ..."
  12.  
  13. >>I recently heard someone mention that the use of 'this' is obsolete,
  14. >>and that another method is preferred...  I've forgotton how, sorry.
  15. >>I also found this claim in the on-line help of Borland C++ 3.1.
  16.  
  17. >Me too - all of the Borland manuals and help files claim 'this' is obsolete,
  18. >and should be replaced by some method using the new operator...naturally,
  19. >they don't give an example, so I continue to use 'this'.  Any suggestions?
  20.  
  21. That's an error in the Borland documentation (in on-line help's "BC++
  22. Language"|"Keywords"|"this").  It should say "assignment to 'this' is
  23. obsolete".  If you don't know what "assignment to this" is, good.  It
  24. was an early (before cfront 2.0) way to choose a different method of
  25. memory allocation when one new's a class object.  The modern, more
  26. efficient and safer way is to overload the class' operator new() and
  27. delete().
  28.  
  29. Every C++ programmer should have either or both Stroustrup's _C++
  30. Prog. Lang. 2nd Ed_ and Lippman's _C++ Primer 2nd Ed_.  Don't rely on
  31. a compiler's manuals to learn the language (then again, don't rely on
  32. most of the C++ books out there to learn the language :-/).
  33.  
  34. Jamshid Afshar
  35. jamshid@emx.utexas.edu
  36.