Wednesday, April 16, 2008

Which end of the egg do you crack. Putting it differently, what is your Endianess


Few people seem to know that the word Endianess comes from Gullivers travels. In Gulliver's travel where there were two types of people, the Lilliputs who cracked the small side of their soft boiled eggs and the Blefuscu who used the big side (Big-Endian). Since I'm well networked these days (over Orkut/Facebook/LinkedIn) I make a conscious decision to be Big-Endian while cracking an egg as its the preferred network endianess.

I do not want to delve into the holy endianess war especially because most modern processors allow hardware/software methods to switch it (reminds me of some politicians though :))

However, I do use bit/byte questions as the acid test for fly/no-fly interviews as suggested by this guy. One of them involves asking about the whole endianess business and a code snippet to find out the endianess of the current system. I'm usually looking for something as below

short a = 1;
if (*((char *)&a) == 1)
printf("Little Endian\n");
printf("Big Endian\n");
The idea is not to look for an exact code but to ensure that there's no complete ignorance of this area...

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.