On Thu, Jan 27, 2005 at 03:00:06PM -0500, Frank D. Engel, Jr. wrote:
> I think it is an internal thing with gcc that the size of a pointer and
> sizeof(int) are always the same, regardless of machine word size...
> with a 64-bit binary, sizeof(int) and sizeof(void *) should both be 8,
> which still causes them to be equal.
Not with gcc 3.4.2 on Solaris 9/sparc -- maybe you're thinking of
sizeof(long).
% cat foo.c
#include <stdio.h>
int
main(void)
{
printf("sizeof(void *) = %d\n", sizeof(void *));
printf("sizeof(int) = %d\n", sizeof(int));
printf("sizeof(long) = %d\n", sizeof(long));
return 0;
}
% gcc -m32 -o foo foo.c
% ./foo
sizeof(void *) = 4
sizeof(int) = 4
sizeof(long) = 4
% gcc -m64 -o foo foo.c
% ./foo
sizeof(void *) = 8
sizeof(int) = 4
sizeof(long) = 8
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/