|
From: Joseph J. S. <jo...@st...> - 2005-01-24 19:48:42
|
At 11:26 AM -0800 1/24/05, James W. Walker wrote: >When compiled with Q3_MEMORY_DEBUG, E3Memory_AllocateClear uses a >block trailer to test for buffer overruns. Exactly what operator >new does on the Mac with CodeWarrior depends on whether we're >talking CFM or Mach-O, and what options were used to compile the >runtime library. The default on Mach-O is that operator new calls >malloc. It also depends on whether someone has added a custom new operator in the appropriate namespace -- something you'd think we have control over, but also something very easy to miss when reading the code. >Also bear in mind that E3ClassInfo* theInfo = new E3ClassInfo ; >would throw an exception if the allocation fails, unless you write >it as >E3ClassInfo* theInfo = new(std::nothrow) E3ClassInfo ; Yes, though this also depends on compiler options. For all those reasons, I think it's better to call Q3Memory_AllocateClear. Best, - Joe -- ,------------------------------------------------------------------. | Joseph J. Strout Check out the Mac Web Directory: | | jo...@st... http://www.macwebdir.com/ | `------------------------------------------------------------------' |