[Mono-devel-list] No defined byte order for C#?

Jonathan Pryor jonpryor at vt.edu
Thu Dec 18 07:39:25 EST 2003


C# and CIL (Common Intermediate Language) DO NOT make any guarantees
about byte order.

>From the ECMA-335 (ECMA CLI) standard, Partition I:

	12.6.3	Byte Ordering

	For datatypes larger than 1 byte, the byte ordering is dependent
	on the target CPU.  Code that depends on byte ordering may not 
	run on all platforms.  The PE file format (See Section12.2) 
	allows the file to be marked to indicate that it depends on a 
	particular type ordering.

Note that this is from the 2nd edition (December 2002) version of the
standard.  The original version did not contain this clause.

 - Jon

On Wed, 2003-12-17 at 17:01, Michi Henning wrote:
> Looking at the language spec, I can't find a statement 
> about the byte order for value types, such as int, float, 
> etc. Are they guaranteed to be little-endian or big-
> endian? I know that, on a little-endian machine, the byte 
> order is little-endian. But what if I run C# on a big-
> endian machine? (I don't have a big-endian machine to
> try this with.)
> 
> Does the C# language (or IL) make any guarantees as to the 
> byte order? 
> 
> Thanks, 
> 
> Michi.
> 
> --
> Michi Henning              Ph: +61 4 1118-2700
> ZeroC, Inc.                http://www.zeroc.com
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list