wide function pointer type

Kaz Kylheku (libffi) 382-725-6798@kylheku.com
Sun Oct 10 18:31:22 GMT 2021


On 2021-10-10 10:44, Martin Uecker wrote:
> Am Sonntag, den 10.10.2021, 10:01 -0700 schrieb Kaz Kylheku (libffi):
>> On 2021-10-10 04:32, Martin Uecker via Libffi-discuss wrote:
>> > Hi all,
>> >
>> > I will propose a wide function pointer type (actually
>> > a wide function type) to WG14 for C23 as a common
>> > type for callbacks, closures, which now require an
>> > additional void pointer argument in C APIs. This
>> > is intended to be compatible with ABIs with now
>> > use a static chain register.
>> 
>> Opposed. There is nothing wrong with separate arguments
>> for function pointer and context.
> 
> Noted.  Your argument sbelow all boil down to the point
> that there are cases where it might not be the ideal
> choice. But nobody forces anyone to use it.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Marin, you should know very well that this argument holds
only for the lone hacker working by herself or himself.

I don't fault you; It has been trotted out by some great minds.

For instance, in some interview in the early 1990's, Knuth
made some nice remarks about the C language, and noted
that you can ignore the parts you don't like, or something
to that effect.(*)

If you're Knuth working by yourself on some great
all-American program, you can, for instance, declare that
the do/while statement is evil, and never use it.

Outside of that, there are multiple somebodies who effectively
force you to use something. You have to use something if
you work with other people's code where it is prevalent.

For instance it appears in legacy code you're working with
and is not easy to eliminate. Or in third party API's.

Moreover, if a feature is a standard part of the language, you
will face standard-backed, authoritarian arguments against
your preference of eschewing it.

Sometimes, it's really better to just nip it at the bud.

---
* http://softpanorama.org/People/Knuth/knuth_interview.html

   "Knuth: I think C has a lot of features that are very important.
    The way C handles pointers, for example, was a brilliant
    innovation; it solved a lot of problems that we had before
    in data structuring and made the programs look good afterwards.
    C isn't the perfect language, no language is, but I think it has
    a lot of virtues, and you can avoid the parts you don't like."


More information about the Libffi-discuss mailing list