Comment

Comment by Joker_vD

> No, I don't believe for a second that any future platform will change their size.

ILP64 (wherein int is 64 bits) exists. It's not very popular, but it exists; e.g. ICC supports it. So it happened in the past once already; it may again happen in the future. In any case, predicting the future is very hard, you really shouldn't be doing this.

> IEEE memory representation of float and double

Wait, what? I'm fairly certain that a) IEEE does not mandate the in-memory representation, and b) ARM actually uses big-endian byte order for floats/doubles when storing them in memory.

> always behave exactly the same (leaving out strange edge cases such as denormals)

So not always, but please pretend so? Yeah, no, thank you.

> platforms have very long agreed on twos-complement for negative integers. This even made it into the standard at some point, I believe.

Only in C23. It was explicitly rejected for C++ 23 (and C++ 26 too, I believe).

> but because everyone of course did the obvious

No, not everyone did the obvious. That's why it took so long to standardize because divergent implementations existed.

> There are much more guarantees modern C++ code can (and should) rely on.

As long as you only use only GCC (or Clang) exclusively, yes, you can. Otherwise, no, you can't and shan't.

parent Joker_vD 1 month ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton