[Scummvm-devel] "free(0)" is valid C, and so is "delete 0;"

Marcus Comstedt marcus at mc.pp.se
Sun Aug 1 04:45:01 CEST 2004


Max Horn <max at quendi.de> writes:

> [...] The C standard specifically defines that free(0) does
> nothing. [...]
>
> To quote the POSIX docs:
[...]
>
> Or to quote Microsoft:
[...]


Wouldn't it make more sense to quote the C standard?  :-)

ยง7.20.3.2:2

  The free function causes the space pointed to by ptr to be
  deallocated, that is, made available for further allocation. If ptr
  is a null pointer, no action occurs. Otherwise, if the argument does
  not match a pointer earlier returned by the calloc, malloc, or
  realloc function, or if the space has been deallocated by a call to
  free or realloc, the behavior is undefined.



 // Marcus





More information about the Scummvm-devel mailing list