[libcxx-commits] [PATCH] D125283: reverts "[libc++] Explicitly reject `uniform_int_distribution<bool>` and `<char>`."
Christopher Di Bella via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon May 23 16:28:57 PDT 2022
cjdb added a comment.
In D125283#3531777 <https://reviews.llvm.org/D125283#3531777>, @ldionne wrote:
> In D125283#3528195 <https://reviews.llvm.org/D125283#3528195>, @EricWF wrote:
>
>> GCC ships this as an extension. I can't find a reason why the extension would be non-conforming or dangerous, and it seems like a safer way for users to generate `char` values, rather than expecting the user to correctly pass the `numerical_limits<char>::max()` to the constructor.
>> I think we should reach out to someone at Microsoft (maybe STL), and see how open they are to shipping this as an extension. If they're willing then we avoid the portability trap that we're trying to protect users from.
>
> @CaseyCarter Would you be willing to, as an extension, support `char` in the random distributions? This is currently marked as being undefined by http://eel.is/c++draft/rand.req.genl#1. If you are willing, then I could also write a short paper to suggest adding it to the spec, since all three major implementations would support it.
I'm not sure why there's so much resistance to reverting. libc++:
1. has users with broken code right now;
2. actively supports `uniform_int_distribution<__int128_t>`, **which is also undefined** (I don't get why you consider `signed char`, `unsigned char`, `char`, and `bool` to be problematic, but not `__int128_t` and `unsigned __int128_t`);
3. has licence to make it an extension without Microsoft/STL's support;
You can also propose standardising this right now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125283/new/
https://reviews.llvm.org/D125283
More information about the libcxx-commits
mailing list