3 ms·
IMHO, it's a bug if it's not specified. If your code looks portable and compiles on a big endian machine and fails, that's a bug. You should really at least fai
by toast0 4y ago
IMHO, it's a bug if it's not specified. If your code looks portable and compiles on a big endian machine and fails, that's a bug. You should really at least fail compilation.
This is different than say a video game that works fine on hardware, but breaks in emulation, as sometimes happens. The game isn't buggy, the emulation is (or at least, it isn't complete), even if the game is writing to 'weird' addresses; it works on the specified hardware.
- int_19h 4y agoBefore we even get to endianness, there's a lot of C and C++ code out there in the wild that is technically broken because it assumes much more basic stuff like int being "large enough" - but the language spec only guarantees you 16 bits. I think at some point we should just bite the bullet and say that this kind of stuff is not really meaningfully standard anymore, and the few niches that need it can be accommodated with extensions. It doesn't really make sense to place a tax on everything else.
- userbinator 4y agoIMHO, it's a bug if it's not specified. If your code looks portable and compiles on a big endian machine and fails, that's a bug. You should really at least fail compilation. I don't care about non-8-bit bytes either, and a bunch of other things, but having to deliberate add checks to "say no" just because someone might decide to use your code on some odd machine is a pure waste of time and even encourages the sort of lock-in and "environment nitpicking" that proprietary software vendors love. As the saying goes, common sense is unfortunately not so common these days.
- rbanffy 4y ago> As the saying goes, common sense is unfortunately not so common these days. Ignoring the existence of big-endian computers is not really common sense. They DO exist. And it'd be very useful to test in both little and big-endian architectures. I cover the endianness tests by running my TravisCI pipelines on amd64 and s390x, but both run on Linux, which is sub-optimal. I should probably add AIX so that I'm not implying the OS is Linux and importing linuxisms into the code when it should be more portable than that.