<xloctime>: apply two-digit year logic only if exactly two digits are read#2666
Conversation
… read Co-authored-by: Stephan T. Lavavej <[email protected]>
|
libc++ applies the two-digit logic even when one digit is read: I'm not sure I agree with that, but should be go with it for compatibility? |
I agree that seems questionable. I'd recommend checking libstdc++'s behavior (not their source code) - if it does the same thing, then we may as well avoid implementation divergence. If libc++ and libstdc++ disagree, I think the compatibility argument is less compelling, and we should instead probably skip the affected test for now, and report it to libc++. |
|
The libc++ logic appears to be as follows:
MSVC is:
Here's the behavior of
There's unanimous agreement about applying the 2-digit rule for single-digit results, so I'll follow that. More surprising to me is that both libc++ and libstdc++ will read more than two digits for
I think this is close to libstdc++ behavior, except for how many digits are read for |
|
We talked about this at the weekly maintainer meeting and @CaseyCarter, @strega-nil-ms, and I all agree with your "If I were working from a blank slate" proposed behavior. 👍 |
This comment was marked as outdated.
This comment was marked as outdated.
|
Looks great - I pushed changes for a few tiny things I noticed (followed by a trivial comment change to rerun the CLA Bot). |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for investigating and fixing this runtime correctness bug while preserving ABI! 🐞 🔍 😻 |
|
I informed libstdc++ and libc++ developers: GCC-105450 and LLVM-55220 Oops, gcc already knew about it: GCC-103612 :) |
Fixes #2618.
ABI note: this replaces a call to the separately-compiled function
_Getintwith a call to the header-only function_Getint_v2. The two functions are virtually identical, so_Getintis rewritten as a wrapper that discards the number of digits read. I think both of these changes are safe, but want to highlight them for closer scrutiny.