Ignoring failures and altering behavior

Paul Eggert eggert@cs.ucla.edu
Wed Oct 17 19:02:00 GMT 2018


On 10/17/18 3:36 AM, Florian Weimer wrote:
> Should we keep running at
> all cost, possibly giving quite different results, or is it better to
> actually report the errors we encounter and stop?

Here's an example I'm familiar with. When localtime runs out of memory, 
it could return NULL with errno == ENOMEM; but in practice glibc 
localtime, like that of many (most?) C libraries, defaults to UTC and 
keeps going even though the resulting values are incorrect. If glibc 
localtime switched to returning NULL in this situation, I imagine a lot 
of (unportable and incorrect) user code will stop working when memory 
gets low; on the other hand, some portable and correct user code will 
start working better. Should we change localtime's behavior?



More information about the Libc-alpha mailing list