Comment Re:Ugh. (Score 2) 159
I'm not too sure about the realloc example. The man page on my Mac says
If size is zero and ptr is not NULL, a new, minimum sized object is allocated and the original object is freed.
That says to me its behaviour is already aligned with the new standard and I'm not sure if it ever wasn't.
Furthermore, I don't think I've ever seen C code that uses the behaviour described by the article. The example of grep doesn't use it, it only uses the "passing in a null pointer is the same as malloc" behaviour. Also, the example stack is a bit bogus. A real implementation would never bother to realloc with less memory because you're almost certainly going to need to grow the stack again at some future time.