
23 Dec
2005
23 Dec
'05
4:03 a.m.
If I'm correct, this could be easily fixed by changing all occurences of "p = std::malloc(n)" to "p = std::malloc(n ? n : 1)" or something similar.
Ok. Applied.
Shouldn't it be applied only if std::malloc returns NULL on 0-sized allocations? A std::malloc implementation that returns unique pointers for zero sizes is OK. Maybe something like:
void * p = std::malloc( n ); if ( !n && !p ) p = std::malloc( 1 ); return p;
would be better?
Does it matter? I do not want to complicate things too much. Gennadiy