SQLite User Forum

Endianness help
Login
Thanks for the replies.

After reading Simon's post I'm a bit less worried about the external storage concern but I'm still not totally convinced. Suppose on my little endian machine I have

uint8_t c[] = {'\0x01', '\0x02'};

and I save that char array to a file on memory stick.

Regardless of how that file is stored on the stick if I load that file back into memory at address a (using an appropriate c function) then

on a little endian machine the bit pattern in a and a+1 will be

10000000 010000000

and on a big endian machine

00000001 00000010

If that's the case I could live with that but it then begs the question why does drh feel the need to store ints in big endian format if the storage device & processor will do it for him (no Warren I don't think drh is wrong - I'm trying to understand).