home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,886 of 243,242   
   Andrey Tarasevich to Tim Rentsch   
   Re: function pointer question   
   07 Jan 26 08:17:24   
   
   From: noone@noone.net   
      
   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..   
      
   --   
   Best regards,   
   Andrey   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca