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,941 of 243,242   
   Andrey Tarasevich to James Kuyper   
   Re: function pointer question   
   10 Jan 26 19:17:35   
   
   From: noone@noone.net   
      
   On Tue 1/6/2026 7:58 AM, James Kuyper wrote:   
   >   
   > However,   
   >   
   >       (void) *foo;   
   >   
   > would be a declaration equivalent to   
   >   
   >      void *foo;   
   >   
   > which is a pointer to void, which would fit the context of our previous   
   > discussion. Could that be what you're actually asking about?   
      
   Um... I believe Tim Rentsch is correct in stating that C declaration   
   syntax does not allow this. When it comes to 'declaration-specifiers'   
   portion of the declaration, the grammar is pretty strict in not allowing   
   and redundant parentheses to slip through. You can't simply parenthesize   
   the type name and still expect it to match the 'declaration-specifiers'   
   grammar.   
      
   The 'init-declarator-list' side is way more permissive in that regard   
      
      int (a); /* equivalent to `int a;` */   
      
   but not what you stated above.   
      
   P.S. On a loosely related note: the C++-like grammatical ambiguity   
   between a function call and a declaration, present in   
      
      { foo(x); }   
      
   is technically present in C as well, but it is prevented by the fact   
   that there's simply no way to declare `foo` as a function and as a   
   typedef name without having one name hide another.   
      
   --   
   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