You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
2Actually, unsigned to signed conversions like this became well-defined in C++20, and are now guaranteed to result in "the unique value of the destination type that is congruent to the source integer modulo 2^N , where N is the width of the destination type" (which is what you would normally expect). This is because, starting from C++20, integers are required to use two's complement for the representationshananton– shananton2025年08月29日 19:55:10 +00:00Commented Aug 29, 2025 at 19:55
-
2Signed overflow due to arithmetic is, of course, still undefined behaviorshananton– shananton2025年08月29日 19:55:32 +00:00Commented Aug 29, 2025 at 19:55
-
@shananton Ah thanks — I updated it to make note of C++20.jwd– jwd2025年08月30日 20:02:22 +00:00Commented Aug 30, 2025 at 20:02
lang-cpp