I’d love feedback, especially from embedded / DSP folks who think this is a terrible idea.
https://isocpp.org/files/papers/P3477R0.html
int8_t guarantees the existence of int64_t. Certainly all modern compilers could implement int64_t by compiling it down to successive int8_t, but should they have to?int_least64_t was already required, and it would be super unlikely for someone to omit int64_t but support int_least64_t. And even more unlikely to have int64_t but not int32_t.@jfbastien Good point, still though.
It also limits anyone wanting to build new Weird Computer Architectures.
@jfbastien but like, ideally the fix for that is more to get compiler makers to not do quite so much "it's undefined behavior so we can do whatever we want!", and less "you're not allowed to use C++ on wonky architectures". I would think.
But we've never even used C++ yet (only C), never ran into the weird UB things people complain about, and so yeah, no personal experience with this stuff.
@jfbastien Oh huh. That makes more sense; why specify it at the spec level, then? There's no benefit except for shafting weird architectures.
Unless there is a benefit somehow?
@jfbastien As someone who's been doing C++ embedded development for quite a few years, I can't remember the last time I saw a non 8 bit byte.
Certainly not in the last decade.
Very much in favor of mandating CHAR_BIT == 8.
@whitequark @jfbastien Yeah and I am very much im favor of making the C++ standard reflect the realities of the 99.99% of hardware everyone actually uses and not UB things because some architecture from the 1970s does it differently.
For example defining that sizeof(&P) == sizeof(&Q) for any P and Q. And allowing printf(%p) to be used directly on any pointer type as a consequence.
Make the actual size implementation defined, by all means. As long as it's the same for any two pointer types.
@whitequark @egallager @jfbastien Similar. It looks like in rust saturation is an operator (saturating_add) rather than a type "integer with saturating operations".
I don't have strong feelings on how it's done in C++ other than wanting a standard way to get overflowing, saturating, or trapping behavior on demand.