[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: long primitive for memory addresses



You don't want to use an int because it may or may not be long enough for a 
memory address on the other hand the long is always the length needed to 
address any memory location. So for greater portability it is better to use a 
long. If i remember correctly the C standard defines an int as being the most 
efficient size for a given architecture, on some that happens the be the same 
as a long.


On Friday 04 July 2003 8:21 am, Kirk True wrote:
> Hi all,
>
> In many kernel data structures (struct pglist_data and struct zone_struct
> at least) pointers to physical memory are represented as long values. On
> the x86 platform, why can't 32-bit memory addresses be represented with
> only an int instead? Or is this just to have to change less code for 64-bit
> architectures?
>
> Thanks,
> Kirk
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/