When should value parameters be destroyed?

mendell at ca.ibm.com mendell at ca.ibm.com
Thu Sep 28 20:14:19 UTC 2000


>From today's meeting, it turns out that g++ destroys value parameters in
the called
function, and that is what the current ABI states.  Our compiler (and I
think HP's)
destroyes them in the caller routine.  I asked our 'standards guy', and got
back the
following:

   Sentence 3, paragraph 3 of 12.2: 'Temporary object are destroyed as the
   last
   step in evaluating the full-expression(1.8) that (lexically) contains
   the point where
    they were created.'

   Also see paragraph 12 and 16 of 1.8 and the note associated with
   paragraph 16.


I believe that this implies that you are NOT allowed to destroy the
temporary in the
called routine, but must destroy it in the caller.    This would mean a
change to
our ABI, and would explain the reason that we pass classes with non-trivial
destructors
by reference (unlike g++).

Mark






More information about the cxx-abi-dev mailing list