[ros-dev] [ros-diffs] [greatlrd] 22195: make malloc, calloc and some other function return NULL if size is 0

Gunnar Dalsnes hardon at online.no
Sat Jun 3 18:57:20 CEST 2006


Magnus Olsen wrote:
> HI
> Malloc(0) did not reaturn NULL;
> that was the fix for. I am reading the IEEE spec
> how malloc should work, and it exists two diffent
> implement of it. and some exprenet on diffent windows
> platfrom show diffent behvior about malloc(0)
> 
> 

IEEE specs really have nothing to do with how Windows behaves. Windows 
NEVER follow standards. A quick test on Win XP shows malloc(0) return a 
pointer to stack, so MSDN is right (surprise!) and your fix is wrong. If 
some older version of Windows did otherwise, this is a job for a 
compability framework (which we dont have).



More information about the Ros-dev mailing list