Re: Diff b/w 32bit & 64-bit

From: Albert D. Cahalan (acahalan@cs.uml.edu)
Date: Mon Jul 01 2002 - 16:52:45 EST


=?iso-8859-1?q?M=E5ns_Rullg=E5rd?= writes:

> For Alpha: sizeof(int) == 4, sizeof(long) == 8, sizeof(void *) == 8
> For intel: sizeof(int) == 4, sizeof(long) == 4, sizeof(void *) == 8

That second line is _only_ correct for Win64.
The Linux way:

char is 8 bits
char may be signed or unsigned by default
short is 16 bits
int is 32 bits
long is the name number of bits as a pointer
long is either 32 bits or 64 bits
long long is 64 bits
don't cast from "foo *" to "bar *" if sizeof(foo)<sizeof(bar)
in a struct, put big items first to avoid padding
don't use "long" in a struct that goes to disk or over the network
with few exceptions, floating-point math in the kernel is prohibited
don't assume that all physical memory is continuously mapped
don't assume that you can DMA to any address you like
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jul 07 2002 - 22:00:08 EST