[email protected] <
[email protected]> wrote:
00157 # define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
00158 do { try { POINTER = new CONSTRUCTOR; } \
00159 catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0;
return RET_VAL; } \
00160 } while (0)
Hi can anyone help me to know
does any memory get allocated in ACE_NEW_RETURN. If yes then where
we are freeing it. Explain me why it is needed to allocate memory
in ACE_NEW_RETURN.What is purpose of ACE_NEW_RETURN.
Allocation of memory happens in "POINTER = new CONSTRUCTOR;" (where
CONSTRUCTOR will be replaced by some actual class name and its con-
struction arguments (possibly none) in parentheses (always needed)
and POINTER will be replaced by an actual pointer variable. Both are
provided as arguments to the macro, as well as an return-value to
be returned from current function in case of allocation failure.
Obviously, the memory is not immediately freed within the macro, but
only "after use" somewhere else (and not even always at the same place
where the macro was used).
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)