[Top][All Lists]

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

Re: [bug-gnulib] Re: comparison_fn_t

From: Larry Jones
Subject: Re: [bug-gnulib] Re: comparison_fn_t
Date: Sat, 28 May 2005 19:28:05 -0400 (EDT)

Paul Eggert writes:
> I should warn you that the C Standard does not allow that sort of
> cast.  This is for portability to hosts that use different
> representations for different kinds of pointers; such hosts can use
> different calling conventions for char * and void *, so casting the
> function pointer will result in code that doesn't work.  Admittedly
> such hosts are rare (typically they're word-oriented machines) but
> all other things being equal we might as well port to them.

As far as I know, such hosts are non-existent.  While what you say is
quite correct for other pointer types, the C Standard requires char *
and void * to have the same representation and alignment and notes that
that is intended to allow them to be used interchangably as arguments to
unprototyped functions, so only a deliberately perverse implementation
would fail.

-Larry Jones

In my opinion, we don't devote nearly enough scientific research
to finding a cure for jerks. -- Calvin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]