Greg Stark <[EMAIL PROTECTED]> 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 if successful. 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 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings