« first day (1768 days earlier)      last day (1080 days later) » 

9:18 AM
What factors influence the endianness? CPU? OS? Compiler?
 
@John cpu pretty much, some cpus support multiple endian modes, so in that sense the OS can play a role too
also the OS needs to support it in the sense that it needs to offer programs stuff like htons, etc. to convert host byte order to some well defined order like network byte order (bug endian) to communicate with different machines
 
nwp
10:00 AM
@PeterT I love that typo.
Inb4 not a typo.
 
 
3 hours later…
12:39 PM
@PeterT So, it's depend on both the CPU and the OS? Do you think the compiler contributes to it?
 
I don't know if I'd say "contributes to it", rather "is aware of it for the platform it targets"
 
12:51 PM
@PeterT I see. Thank you.
 
@John Only in the sense it's aware of the conventions of the platform.
 
 
3 hours later…
3:47 PM
@John In a traditional tool chain, the compiler produces assembly language as output, and doesn't need to be aware of endianness. Depending on object file format, the assembler might need to be, and the linker almost certainly would. Some compilers (e.g., Microsoft) produce object files directly, in which case they'd normally need to be also.
Most executable formats have an endianness flag, so in theory, you could push it all off to the loader, which would have to do swapping as it loaded a file in the wrong endianness. I'd guess most loaders don't do that though--they probably check that the flag is what they expect, and give up if it's not (but I've never looked to be sure).
 
 
1 hour later…
4:57 PM
@JerryCoffin trying to actually think if the compiler cares in most cases... honestly? if you're just dealing with registers and memory you really don't in most cases unless there is weird mixed endian garbage going on....
 

« first day (1768 days earlier)      last day (1080 days later) »