tech-misc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Endian-specific types



> On Sep 8, 2016, at 1:45 PM, Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
> 
>>> ive toyed with the idea of making types like this: [...endianness...]
> 
> Much of the problem with endian-specific types is that - at least in C,
> and I think in C++ - types describe values, and endianness is not a
> property of a value; it's a property of a value as serialized into an
> octet (or other unit smaller than the value) stream.  It does not make
> sense to talk about the endianness of a value in a CPU register, any
> more than it makes sense to talk about the bit-endianness of a byte in
> memory (unless the machine supports bit addressing or otherwise imposes
> some ordering on the bits within a byte).

True except for a few benighted machines that chose to apply endianness to some registers (Raza XLR I/O registers are an example, and PCI registers are another).

But types have a memory representation, and since memory is usually byte addressable, the byte order is necessarily part of the type.  It is true that for standard types the byte order is usually not part of the standard.  But it's clearly a property of the type even though it may be an implementation-dependent one.

	paul



Home | Main Index | Thread Index | Old Index