Re: [PATCH][2.6.6-rc3] gcc-3.4.0 fixes

From: Mikael Pettersson
Date: Tue Jun 01 2004 - 10:38:01 EST


William Lee Irwin III writes:
> On Tue, Jun 01, 2004 at 04:52:59PM +0200, Mikael Pettersson wrote:
> > You're assuming pointers have uniform representation.
> > C makes no such guarantees, and machines _have_ had
> > different types of representations in the past.
> > Some not-so-obsolete 64-bit machines in effect use fat
> > representations for pointers to functions (descriptors),
> > but they usually cheat and use pointers to the descriptors
> > instead. However, a C implementation could legally
> > represent a function pointer as a 128-bit value, while
> > data pointers remain 64 bits.
>
> IIRC for all types foo, sizeof(foo *) <= sizeof(void *), no?
> If so, 128-bit function pointers implies >= 128-bit void pointers.

No, sizeof(foo*) <= sizeof(void*) only holds for data pointers.
The C standard is very explicit about not guaranteeing any
relationship between function pointers and void*. However,
a function pointer can be converted to a pointer to a different
function type and back again, without loss of information.

/Mikael
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/