From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) by sourceware.org (Postfix) with ESMTPS id 254333858402 for ; Sun, 10 Oct 2021 17:01:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 254333858402 Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id ZbWom1MnGczbLZcClmLUaO; Sun, 10 Oct 2021 17:01:43 +0000 Received: from kylheku.com ([70.79.163.252]) by cmsmtp with ESMTPA id ZcCimNNoH2J2fZcCkmcMgV; Sun, 10 Oct 2021 17:01:43 +0000 X-Authority-Analysis: v=2.4 cv=P8xZOgMu c=1 sm=1 tr=0 ts=61631c77 a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=8gfv0ekSlNoA:10 a=GCr9Du0Qp307AnsuH6QA:9 a=QEXdDO2ut3YA:10 Received: from www-data by kylheku.com with local (Exim 4.72) (envelope-from <382-725-6798@kylheku.com>) id 1mZcCf-0004vv-5j; Sun, 10 Oct 2021 10:01:37 -0700 To: Martin Uecker Subject: Re: wide function pointer type X-PHP-Originating-Script: 501:rcmail.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Date: Sun, 10 Oct 2021 10:01:37 -0700 From: "Kaz Kylheku (libffi)" <382-725-6798@kylheku.com> Cc: libffi-discuss@sourceware.org Message-ID: <09d27268d43fc4a8885695eba840faa4@mail.kylheku.com> X-Sender: 382-725-6798@kylheku.com User-Agent: Roundcube Webmail/0.9.2 X-CMAE-Envelope: MS4xfLYhpWf7KF2PUo5rr2jeA8isaHXBd5eOZGxvwe9gdSXQUk/MvnItyHB2pRGZnLvjqyfgCRwOtALpOkABk0KGO6Uq6SXCTqTjP3eD5GzLS2Oh8DD7omr/ JgFn1IpYt1UfWb4tlUU/M4ZPh9ghuNRqSj22leDA6bwc6m9I9C7kaV/rZtow7Xu2cXAnoCOcXSQeyxUJfa931mTjCBWAg8atrRXE+hzw4zYR7b+CwB9eR3kc X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FROM_STARTS_WITH_NUMS, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libffi-discuss@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libffi-discuss mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Oct 2021 17:01:45 -0000 On 2021-10-10 04:32, Martin Uecker via Libffi-discuss wrote: > Hi all, >=20 > 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. Higher level languages that interface C or are built on C do not agree on an exact representation for closures; it's not a good idea to second guess them. Many languages are perfectly able, in their implementations, to represent function callable objects of all sorts using ordinary pointer-sized reference values. What those values refer to varies quite a bit. Callback mechanisms are often bound to OOP-style objects rather than closures. The same context pointer is associated with more than one callback. The context argument has the right flexibility to cover all the situations that arise. In some library API's, the object pointer is registered separately, and then other functions implicitly use it when invoking callbacks, so it doesn't have to be passed any more. Sometimes there are multiple callbacks, but one context pointer, passed in one call: initiate_operation(arg, callback_context, get_data_fn, progress_fn); Should there be a triple wide pointer just to roll three arguments into one?