Re: Strange interval arithmetic
От | Tom Lane |
---|---|
Тема | Re: Strange interval arithmetic |
Дата | |
Msg-id | 16807.1133469785@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Strange interval arithmetic (Greg Stark <gsstark@mit.edu>) |
Список | pgsql-hackers |
Greg Stark <gsstark@mit.edu> writes: > Ah, I take back my taking back of this. It's still dicey to be doing it this > way -- even if you reset errno before calling the library function. See the rest of the thread. The I-believe-what-I-read-in-the-spec camp may take comfort from what it says in the SUS strtol spec, http://www.opengroup.org/onlinepubs/007908799/xsh/strtol.html The strtol() function will not change the setting of errno ifsuccessful. Those who are disinclined to assume that implementations always follow the spec may take comfort from the fact that we've been testing errno only (without also inspecting the return value) in pg_atoi for years without problems. From neither point of view do I see an argument for adding a test on the return value. It's unnecessary according to the spec, and if you disbelieve that strtol follows the spec, you should also be suspicious about whether it's guaranteed to return LONG_MAX/LONG_MIN upon overflow failure. We have no track record that gives evidence that the latter is universally true. regards, tom lane
В списке pgsql-hackers по дате отправления: