|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Whether T's product is defined on all of T: a word narrower than int multiplies after promotion to int, and the largest product must fit it. unsigned char's does (255 · 255); unsigned short's does not (65535 · 65535 overflows int, undefined as -INT_MIN is), so it is refused as int is. Decided by the compiler: undefined behaviour is no constant expression. Unsigned words only: there the product grows with its factors, so the largest is the one that may overflow, and numeric_limits names it (a type without limits has max() == T{}, and the probe would check only 0 · 0).
More...
Whether T's product is defined on all of T: a word narrower than int multiplies after promotion to int, and the largest product must fit it. unsigned char's does (255 · 255); unsigned short's does not (65535 · 65535 overflows int, undefined as -INT_MIN is), so it is refused as int is. Decided by the compiler: undefined behaviour is no constant expression. Unsigned words only: there the product grows with its factors, so the largest is the one that may overflow, and numeric_limits names it (a type without limits has max() == T{}, and the probe would check only 0 · 0).
| T | the carrier, an unsigned word. |