高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】memory management - odrxallocodrxrealloc
memory management - odrxalloc/odrxrealloc
memory management - odrxalloc/odrxrealloc
i have provided my own implementation of the the odalloc.h functions: odrxalloc and odrxrealloc. if my custom implementation cannot allocate memory for some reasons, should i be throwing an oderror(eoutofmemory) exception?
however these are defined in extern "c" block in the header file odalloc.h.
this means i am not supposed to throw from them(as expected there's a warning by vc compiler if i do so). should i just return null if my odrxalloc and odrxrealloc fail??
tia
alex.
odrxalloc and odrxrealloc functions are analgous to ::malloc/::free pair, and should not throw exceptions. (but, your overloaded "new" operator should throw exception if allocation fails)
vladimir
|