Nov. 5, 2022
9:02 a.m.
Paul Eggert via tz said:
It's unfortunate that the C standard allows malloc to return NULL on success, as this complicates error checking. Of course zic.c should be portable even to platforms that exploit this glitch in C.
We're back to the "there are no zero-sized objects in C" point. Therefore malloc(0) is an error by definition. I remember us coming up with the compromise wording that allowed either failure or success (but you can't access the returned memory), but I don't recall the details of why. -- Clive D.W. Feather | If you lie to the compiler, Email: clive@davros.org | it will get its revenge. Web: http://www.davros.org | - Henry Spencer Mobile: +44 7973 377646