dotgnu-general
[Top][All Lists]
Advanced

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

Re: [DotGNU]Endianness?


From: Rhys Weatherley
Subject: Re: [DotGNU]Endianness?
Date: Mon, 10 Nov 2003 06:20:48 +1000
User-agent: KMail/1.4.3

On Sunday 09 November 2003 08:23 pm, Fergus Henderson wrote:

> Does Microsoft's C/C++ compiler actually generate code which _requires_
> that the CLR's run-time data representation be little-endian?

Global variables are laid out in .data sections, as if they were flat byte 
arrays, and there is insufficient type information to determine what the 
original contents were to byte-swap or re-align.

> Or does it just generate code whose behaviour might be different
> if run on a system with different endianness?

I'm not talking about quirks here.  I'm talking about the wrong values being 
read from memory locations, or bus errors due to misaligned accesses (where 
struct alignment differs between platforms).

> If the latter, why would you consider it bad for a C/C++ compiler
> to generate code whose behaviour may depend on the enddianess of the
> target system?

If the resulting binary won't run on multiple platforms, it kind of defeats 
the purpose of having a cross-platform bytecode format, no?  Remember, the 
name of my project is "Portable".NET.  I consider non-portable design to be 
bad by definition.

Now, of course, a programmer can write non-portable C code on top of a 
portable engine just by being sloppy.  But my main objection is this: if I 
write portable C, using all the usual conventions for avoiding 
platform-specific behaviour, the resulting IL should run everywhere.  But 
with Microsoft's compiler, it won't.

Cheers,

Rhys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]