This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: making sizeof(void*) different from sizeof(void(*)())

On Sun, 29 Apr 2012 09:43:02 -0400
Robert Dewar <> wrote:

> On 4/29/2012 9:25 AM, Andreas Schwab wrote:
> > Robert Dewar<>  writes:
> >
> >> Just to be clear, there is nothing in the standard that forbids the
> >> sizes being different AFAIK? I understand that both gcc and apps
> >> may make unwarranted assumptions.
> >
> > POSIX makes that assumption, via the dlsym interface.
> that's most unfortunate, I wonder why this assumption was ever
> allowed to creep into the POSIX interface. I wonder if it was
> deliberate, or accidental?

IIRC, some old POSIX drafts proposed to add another function, perhaps dlfsym,
whiwh would be used for functions, and would be compatible with function pointers of
different size than data pointers.

But it didn't make into the proposal.

My biased point of view is that designing a processor instruction set (for POSIX-like
systems or standard C software in mind) with function pointers of different size than
data pointers is today a mistake: most software make the implicit assumption that all
pointers have the same size.


email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]