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: Fri, 09 Jan 2026 09:14:22 -0800
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <86cy3in1xt.fsf@linuxsc.com>
References: <10j7rs6$7c9e$1@dont-email.me> <20260102091518.226@kylheku.com> <10j96mn$jrsp$1@dont-email.me> <10jc4n0$1ijf2$1@dont-email.me> <10jftcp$2locm$3@dont-email.me> <10jivdb$3p6r2$1@dont-email.me> <10jjbfc$3jbe4$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Fri, 09 Jan 2026 17:14:26 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="f91fed21d6d70b765bc081afc1b51c1a"; logging-data="2639609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/c4MiubiPu65PXwAlUNzKNLf9u0GC7cUk="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:RF4720vz7Zfc94vWDSYvLfznxLo= sha1:qmQ08xEXtF6Aw24AHVrgMuoOl+U=
Xref: csiph.com comp.lang.c:396326
James Kuyper writes:
> On 2026-01-06 07:32, Michael Sanders wrote:
>
>> On Mon, 5 Jan 2026 08:39:53 -0000 (UTC), Michael Sanders wrote:
>>
>>> I might have questions down the road...
>
> In the message you were responding to, I was talking about declarations,
> not expressions.
>
>> One more question, but 1st the context...
>>
>> I asked ChatGPT this question:
>>
>> In C, what is the most common meaning of (void) *foo
>
> I'm curious - in what context did you encounter that code? As written,
> it's an expression, and foo would have to be a pointer to an object,
That statement is simply wrong. The identifier foo could name a
function, or be of type pointer to function, or be of type pointer
to an object type (and whose value might or might not point to an
object). A compiler might issue a diagnostic if foo has a type
that is a pointer to an incomplete object type, but ABICD the C
standard doesn't actually require that; the constraint says that
the operand "shall have pointer type".
> which would be a change of subject from the previous messages in this
> thread.
>
> 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?
In what context is '(void) *foo;' considered a declaration?
AFAICT it doesn't satisfy the syntax rules of any version
of ISO C.