[llvm-dev] RFC: On removing magic numbers assuming 8-bit bytes
David Greene via llvm-dev
llvm-dev at lists.llvm.org
Thu May 2 14:04:44 PDT 2019
JF Bastien via llvm-dev <llvm-dev at lists.llvm.org> writes:
> I’m not a fan of C and C++ supporting anything but 8 bits per
> byte. Realistically, C and C++ on such targets are different languages
> from 8-bit-per-byte C and C++, and therefore code isn’t portable from
> one to the other. I intend to propose that C++23 support only 8 bits
> per byte, ditto C. I’m therefore not a fan of teaching clang about
> this.
It depends on what you mean by "byte." Is "byte" a unit of addressing
or a unit of data?
We have worked with machines that had word-level (32-bit) addressing.
8-bit data works just fine on such machines, you simply treat them like
bitfields. Types like sint8_t are reasonable on such machines. Types
like sint8_t * can also be reasonable.
I think it would be pretty bad to restrict either language to 8-bit
bytes.
-David
More information about the llvm-dev
mailing list