--
You received this message because you are subscribed to the Google Groups "cxx" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cxx+uns...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACWgwAZAVW-B61MXUrCQVZaFeAo-jp5n9KOGX3gTJkJeVZATgg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAFd1Zwc4Kr6P9LtR_sFZmeazYytiD55oN7F203S366BmX8H1Hw%40mail.gmail.com.
👀I have landed several C++20 changes to PA and PA's copy of base. I sent them for review. Was that something I should not have done?
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CACWgwAaWPFq%2BLNw5cqSasgLo2zQMAcDms_zth%3Dn-D1ZztWPNHA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAHtyhaRm89meyK%3D%2BQD4TpB%2BcxocT_are-4nMyxC9LB6EL1a%3DBQ%40mail.gmail.com.
That would happen in the Clang bug tracker? Do they require an implementation, or would just a writeup of the problem do?
OK, I did a quick audit of the ~2500 calls in ~400 files, and I honestly am shooketh. Seriously rattled.There is a lot of usage of "bit cast this pointer into a different pointer type and read/write through it". A lot. By a lot of folks who are knowledgeable.I can imagine that bit_cast is the only way to get a pointer with one set of bits to another in some of these cases. But I don't see how that fixes the UB issue. Am I missing some subtle way that bit casting a pointer is OK?
Note that the entire section about "safely derived pointers" was removed by P2186R0 from the current standard as part of the removal of the GC support.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAHtyhaQdXprUAMG4_Voj8FrF1OhFgtOn3wtygntfBJV%2BSGK%2Bog%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAC_ixdxvci8NNs9jE1XXwsXPQfXE4%3DDS%3Dh5D%2BrehqJ0wW_-_DQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAGFX3sFz%2BXjdwyvikkjWrtt7m3CUdEWNoBMJF7%2BdaVGhJ%3DjEQQ%40mail.gmail.com.
I propose we ban std::bit_cast and make base::bit_cast static_assert telling you to use reinterpret_cast if you try to bit_cast between pointers or between pointers and {u,}intptr_t,
I think it'd be worth filing this as a suggestion for a regular Clang warning, if nothing else to get a discussion going. (I suppose it may well end up as a clang-tidy warning instead though.)
To be clear, I don't want to say that "most" usage in Chromium is dubious. Lots of it is, but there is actually a decent amount that looks correct at first glance.
PTAL at my audit of bit_cast use. We could add static_assert (or concepts or whatever) to base::bit_cast, but that would break a ton of code, very hard. This architectural issue goes very deep, and would require the redesign of core 3p libraries from scratch.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/cxx/CAHtyhaQuqcOJUcz9x4X%2Bvh3oaH0Hop86ANnuBBUHXkJCKx%2BMYQ%40mail.gmail.com.