home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / std / cplus / 1592 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.5 KB  |  31 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!microsoft!hexnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: return values and destructors
  5. Message-ID: <1992Nov17.204640.9222@microsoft.com>
  6. Date: 17 Nov 92 20:46:40 GMT
  7. Organization: Microsoft Corporation
  8. References: <1dsevkINNe8t@agate.berkeley.edu> <1992Nov12.132254.1@vax1.bham.ac.uk> <BxMxxB.CMp@scd.hp.com>
  9. Lines: 20
  10.  
  11. In article <BxMxxB.CMp@scd.hp.com> vinoski@ch.apollo.hp.com (Stephen Vinoski) writes:
  12. |There is also a similar potential problem with exceptions and throw
  13. |statements; what happens if the value of the thrown object is affected
  14. |by the destructors executed due to stack unwinding before the throw
  15. |actually occurs?
  16.  
  17. I still believe you're being confused by a compiler bug.  Can you quote
  18. ARM to support your position?  Seems clear to me that a throw expression
  19. has to be evaluated in scope, which means it must be evaluated before
  20. the destructors, since destructors occurs on exiting scope.  Once the
  21. throw expression has been evaluated, the throw object *has* its value, 
  22. and the destructors can do what they want without affecting its value.
  23.  
  24. Likewise on return values.  The return expression must be evaluated in
  25. scope which means it must be evaluated before the dtors so it must already
  26. *have* its value by the time scope is exited and dtors are executed.
  27. If the return object tries to get its value after dtoring its a compiler bug,
  28. since the dtoring implies scope has already been exited so then how could
  29. the return expression be being evaluated in scope?
  30.  
  31.