Manu <[email protected]> writes:
> And that octal reading is the harmful part, not something worth keeping. A
> leading-zero operand containing an 8 or 9 is truncated silently, not
> rejected: '08' and '09' both parse as 0, '-08' as 0 with the sign dropped,
> '018' as 1, and '02147483647' as 9020. That is worse, and quieter, than
> the '010' -> 8 in Marko's report.
Oh, that's an excellent point: if we did want to go the direction of
exposing strtol's full behavior, we'd need to make the code check
that strtol ate the whole input, which it does not today. I think
it's unnecessary to add such a check if we switch to base 10
(maybe I'm wrong?).
regards, tom lane