I find in the standard:
The representations of integral types shall define values by use of a pure binary numeration system
But my understanding is that this is not a requirement that C++ must be implemented on machines that are based on base 2 in hardware; in other words, this seems to be only a requirement for what the programmer shall see.
Does the C++ standard require a binary CPU, or could a valid C++ implementation be implemented on ternary or decimal machines?
tiny background info: in history, there have already been computers with decimals, ternaries, or computers where a C++byte would be 36 bits long (PDP-10)
Although never directly stated in the standard, there's an "as if" rule that applies to essentially all requirements in the C++ (and C) standard.
In other words, you're allowed to break any rule you want to, as long as you produce the same externally observable effects as if you'd followed the rule as stated. Although not stated in the standards themselves, this rule is explicitly stated in the Rationale for the C standard. As far as I know, there's no matching rationale for the C++ standard, but the two are closely enough related that I see little problem in applying the rule to both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With