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,943 of 243,242    |
|    James Russell Kuyper Jr. to Andrey Tarasevich    |
|    Re: function pointer question    |
|    10 Jan 26 22:39:37    |
   
   From: jameskuyper@alumni.caltech.edu   
      
   On 2026-01-10 22:17, Andrey Tarasevich wrote:   
   > 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.   
   >   
      
   I had remembered that parantheses could be optionally (and pointlessly)   
   added surrounding a declarator (6.7.7.1p6). Since it's a feature I would   
   never bother using, I didn't pay much attention to the details, and   
   forgot that it applies only to the declarator. I should have checked   
   before posting.   
      
   --- 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