

Linux kernel booting process, part 3 - 0xAX
https://github.com/0xAX/linux-insides/blob/master/Booting/linux-bootstrap-3.md

======
zackmorris
Cool article, one thing that's been irritating me lately is how everyone is
taking this table on faith:

| Type | char | short | int | long | u8 | u16 | u32 | u64 |

|------|------|-------|-----|------|----|-----|-----|-----|

| Size | 1 | 2 | 4 | 8 | 1 | 2 | 4 | 8 |

Here are the corrected tables, now a relic of history:

32 bit:

| Type | char | short | long | int | u8 | u16 | u32 | u64 |

|------|------|-------|-----|------|----|-----|-----|-----|

| Size | 1 | 2 | 4 | 4 | 1 | 2 | 4 | 8 |

64 bit:

| Type | char | short | long | int | u8 | u16 | u32 | u64 |

|------|------|-------|-----|------|----|-----|-----|-----|

| Size | 1 | 2 | 4 | 8 | 1 | 2 | 4 | 8 |

Instead we traded convention for programmer convenience, so that companies
like Apple could mandate 64 bit binaries under the pretense that programmers
wouldn’t have to do much work to convert from 32 (since they mistakingly kept
int 4 bytes).

The fact is that originally long was 4 bytes and int was the native width of
your processor (int should be 8 on most CPUs today, as they are 64 bit). Using
long before a term like int doubled the length and created confusion as well.

~~~
Rusky
Changing sizes on different processors is a bad idea- most uses should be
fixed-size for ease of portability, and using 64-bit ints for a "default" type
isn't always the best for performance.

Also, it's unclear from your post, but to clarify: the C standard mandates
that sizeof(int) <= sizeof(long).

------
cvs268
Nice series. Waiting for an episode or two about Linux kernel on ARM.

