查看单个帖子
旧 2009-05-06, 05:40 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】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
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)