2 ms·
I just ran it on my M2 mac and got 04. Don't compilers typically take endianness into account for things like this anyway?
by clarebear123 2y ago
I just ran it on my M2 mac and got 04. Don't compilers typically take endianness into account for things like this anyway?
- odo1242 2y agoNo, compilers don’t take endianness into account. (especially not C) You need to use a bit mask in order to make this code endian-independent rather than a pointer alias. Like (uint8_t)(int & 0xFF), or something like that.
- Panzer04 2y agoWhy would it do that? You're asking for a raw memory address value.