[tz] Bug in 2022f version of zic.c

Clive D.W. Feather clive at davros.org
Sat Nov 5 09:02:47 UTC 2022


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 at davros.org     | it will get its revenge.
Web: http://www.davros.org  |   - Henry Spencer
Mobile: +44 7973 377646


More information about the tz mailing list