public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andy <borucki.andrzej@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: How to explain this syntax?
Date: Sun, 16 Apr 2023 12:25:28 +0200	[thread overview]
Message-ID: <CAE2KeA+4w8bF=3jxmL56osyqQNFaetRY=q9_UEKrkM69frNAww@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

In gcc/gcc/testsuite/gcc.c-torture/compile/pr43635.c
we have

extern void d (void);

void (*foo (void)) (float)
{
  void (*(*x) (void)) (float) = d;
  return (*x) ();
}

d is a function without parameters and nothing returns.
foo is function without parameters and returns pointer to function with one
parameter float and also returning void?
what is type of x?
void (*(*x) (void)) (float) is on whole type definition of x or part is
type definition of x and part is cast d to x? which parts?
why not returns x but (*x) ()? don' t return pointer to function but call
this function?
I know, this is malignant example, in in real world can't be cast function
returning void to function returning value

             reply	other threads:[~2023-04-16 10:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16 10:25 Andy [this message]
2023-04-16 10:53 ` Andrew Haley
2023-04-19 11:40 ` Andy
2023-04-19 11:53   ` Xi Ruoyao
2023-04-19 12:35     ` Andy
2023-04-19 12:41       ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAE2KeA+4w8bF=3jxmL56osyqQNFaetRY=q9_UEKrkM69frNAww@mail.gmail.com' \
    --to=borucki.andrzej@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).