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

  1. Path: sparky!uunet!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!sobeco!philmtl!vedge!hendrik
  2. From: hendrik@vedge.UUCP (Hendrik Boom)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: destruction of temporaries
  5. Message-ID: <28619@vedge.UUCP>
  6. Date: 26 Aug 92 13:42:47 GMT
  7. References: <TMB.92Aug21160625@arolla.idiap.ch>
  8. Organization: Visual Edge Software, St. Laurent, Quebec
  9. Lines: 44
  10.  
  11. tmb@arolla.idiap.ch (Thomas M. Breuel) writes:
  12. : Under either rule, expressions can already be rewritten to obtain the
  13. : desired lifetime. For example:
  14. :     X result = x.a().b().c().d();
  15. : Language: early destruction, Wanted: late destruction:
  16. :     X a = x.a();
  17. :     X b = a.b();
  18. :     X c = b.c();
  19. :     X result = c.d();
  20. : Language: late destruction, Wanted: early destruction:
  21. :     X a = x.a();
  22. :     X b = a.b();
  23. :     destroy(a);
  24. :     X c = b.c();
  25. :     destroy(b);
  26. :     X result = c.d();
  27. :     destroy(c);
  28. What is 'destroy'? Some language feature I don't know about that
  29. isn't in the ARM syntax?  Or a user-defined member funtion that has
  30. no control over the calling of the actual destructors of members
  31. of a, b, and c?
  32.  
  33. : The question is: what should be the default. I don't think that
  34. : mandatory late destruction solves anything, because if you start
  35. : relying on the persistence of temporaries in expressions, the next
  36. : step is that you'll get confused about why they don't hang around for
  37. : the whole block.
  38.  
  39. And you have to worry about a destroy function that can't actually
  40. destroy very much.
  41. :                     Thomas.
  42. -- 
  43. -------------------------------------------------------
  44. Try one or more of the following addresses to reply.
  45. at work:    hendrik@vedge.com,  iros1!vedge!hendrik
  46. at home:    uunet!altitude!ozrout!topoi!hendrik
  47.