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.
Hi,Everyone
When I read the source code of ACE.
I can't understand why the define of ACE_NEW_RETURN use "while(0)"?
just in line 157 of the OS_Memory.h
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)
Who will be kind enough to tell me that the defference between the
follow codes
00157 # define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
00158 try { POINTER = new CONSTRUCTOR; } \
00159 catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0;
return RET_VAL; } \
00160
Thanks
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 294 |
Nodes: | 16 (2 / 14) |
Uptime: | 244:54:29 |
Calls: | 6,626 |
Calls today: | 2 |
Files: | 12,175 |
Messages: | 5,320,400 |