[llvm-dev] RFC: On removing magic numbers assuming 8-bit bytes

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon May 6 02:43:15 PDT 2019

On Mon, 6 May 2019 at 10:13, James Courtier-Dutton via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Although the above is mentioning bytes, looking at the "/ 8"   and "& 0x7" makes it look like the author meant octets and not bytes.
> Bytes can be any size of bits.

I don't think you'll have much luck trying to make that stick for a
general audience, or even a general compiler-writer audience. Byte is
far too strongly associated with 8 bits these days.

> Octets are only ever 8 bits.

You might be able to convert all uses of byte to octet and abandon
byte entirely, but at that point why bother? It feels like a change
just for the sake of pedantry.

I like the "addressable unit" name, though it's a bit long (AddrUnit
seems OK). It at least signals to a reader that there might be
something weird going on. Getting someone writing new code to think in
those terms is a different matter, of course, but I don't think any of
the changes under discussion really help there.

BTW, is there an open source backend (in a fork, I assume) that does
this? So that we can get some kind of idea of the real scope of the
changes needed.



More information about the llvm-dev mailing list