Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: function pointer question Date: Wed, 07 Jan 2026 18:27:02 -0800 Organization: A noiseless patient Spider Lines: 51 Message-ID: <86pl7kon49.fsf@linuxsc.com> References: <10j7rs6$7c9e$1@dont-email.me> <20260102091518.226@kylheku.com> <10j96mn$jrsp$1@dont-email.me> <10j9enb$p6ts$2@dont-email.me> <10j9g71$pr9o$1@dont-email.me> <10jb3j5$17gcb$3@dont-email.me> <10jbsp0$1gf7e$1@dont-email.me> <10jc02j$1hk1n$1@dont-email.me> <86bjj5phai.fsf@linuxsc.com> <10jm0ul$oq53$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 08 Jan 2026 02:27:12 +0000 (UTC) Injection-Info: dont-email.me; posting-host="f646824e109d26d154da12d2f3c25277"; logging-data="1245349"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XW5susszUhhAwfV+E+ktpkNzliOQYZ08=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:zDYHicEGkEiFCDdAJlUSmE/zZXc= sha1:lmhgL9n5srtoht4d+pcQGKTvU6Q= Xref: csiph.com comp.lang.c:396290 Andrey Tarasevich writes: > On Wed 1/7/2026 7:35 AM, Tim Rentsch wrote: > >> Andrey Tarasevich writes: >> >>> On Sat 1/3/2026 12:04 PM, Chris M. Thomasson wrote: >>> >>>> struct object_prv_vtable { >>>> int (*fp_destroy) (void* const); >>>> }; >>> >>> And interesting piece of trivia about C function types and function >>> type compatibility rules is that: >>> >>> 1. Top-level qualifiers on function parameters are preserved as part >>> of function type. >> >> Not completely wrong but not exactly right either. >> >>> However, such top-level qualifiers are ignored when >>> determining function type compatibility. >> >> It's easier to take the point of view that top-level qualifiers >> for function parameters don't participate in the type of the >> function as a whole. Taking that view is easier to understand >> and gives results that are indistinguishable from the actual >> rules. > > No, that's not entirely accurate. > > The C17 modifications I mentioned in my previous post stems from DR#423 > > https://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_423 > > which is related to how qualifications are treated under > _Generic`. `_Generic` operates on "exact match" basis not on "type > compatibility" basis. Which is why such matters suddenly become > important. > > The DR itself is about qualifications on rvalues (another thing that > "did not matter" previously), not about function parameters. But it is > clear that it applies to our topic as well. > > I have no time to research it further at the moment (will do it a bit > later), but something tells me that `_Generic` is expected to "see" > and distinguish the exact const-qualification of function parameters > in function types. If so, it might be a "useless" feature, but still.. I see you have posted a further followup. I am responding to that.