home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13088 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  1.6 KB

  1. Path: sparky!uunet!igor!thor!rmartin
  2. From: rmartin@thor.Rational.COM (Bob Martin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Destruction of temporaries
  5. Message-ID: <rmartin.715268992@thor>
  6. Date: 31 Aug 92 13:49:52 GMT
  7. References: <MCGRANT.92Aug26232410@rascals.stanford.edu> <23563@alice.att.com> <rmartin.715004480@thor> <23583@alice.att.com> <rmartin.715101472@thor> <23590@alice.att.com>
  8. Sender: news@Rational.COM
  9. Lines: 28
  10.  
  11. ark@alice.att.com (Andrew Koenig) writes:
  12.  
  13. |In article <rmartin.715101472@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  14.  
  15. |> No, I want a warning every time a temporary gets converted into a
  16. |> pointer.  
  17.  
  18. |All that will do is cause library authors to write little classes
  19. |that contain pointers to suppress warnings.  Or maybe they'll use
  20. |explicit member function calls instead of implicit conversions.
  21.  
  22. These strategies should not supress the warnings.  ANY time an address
  23. or reference to a temporary is taken, whether is is via implicit
  24. conversion, or as the argument of a member function, a warning should
  25. be issued.  No exceptions.
  26.  
  27. This will flag every instance where a long lived alias to a temporary
  28. could be created.  Unfortunately it will also flag the creation of
  29. perfectly benign aliases.  As I said in an earlier post, compiler
  30. writers could implement #pragmas which allowed programmers to
  31. name functions which were known to create benign aliases.  
  32.  
  33.  
  34. --
  35. Robert Martin                        Training courses offered in:
  36. R. C. M. Consulting                       Object Oriented Analysis
  37. 2080 Cranbrook Rd.                        Object Oriented Design
  38. Green Oaks, Il 60048 (708) 918-1004       C++
  39.