From: Glynn Clements <glynn@gclements.plus.com>
To: soraberri <421246@posta.unizar.es>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: anything to do with pointer to functions maybe?
Date: Thu, 30 Dec 2004 11:26:12 +0000 [thread overview]
Message-ID: <16851.58836.918096.548317@gargle.gargle.HOWL> (raw)
In-Reply-To: <cqe6ed$ldf$1@sea.gmane.org>
soraberri wrote:
> I'm having troubles understanding code:
>
> what type is __sighandler_t if it is defined this way:?
> typedef void (*__sighandler_t) (int);
Pointer to function taking an int argument and returning void.
C's type syntax uses the same grammatical structure as expressions, so
the above is interpreted as saying that the expression:
(*__sighandler_t) (int)
has type "void".
The syntax <expr>(<args>) indicates a function call where the function
is <expr> and the arguments are <args>, so:
(*__sighandler_t) (int)
is a function call where (*__sighandler_t) is the function and the
arguments consist of a single integer. Coupled with the knowledge that
the overall type is "void", the expression:
(*__sighandler_t)
must be a function taking an integer argument and returning void.
If an expression *P has type T then the type of P is "pointer to T",
so __sighandler_t must be a pointer to a function taking an integer
argument and returning void.
--
Glynn Clements <glynn@gclements.plus.com>
prev parent reply other threads:[~2004-12-30 11:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-23 10:24 anything to do with pointer to functions maybe? soraberri
2004-12-23 11:47 ` Jan-Benedict Glaw
2004-12-23 14:19 ` soraberri
2004-12-30 11:26 ` Glynn Clements [this message]
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=16851.58836.918096.548317@gargle.gargle.HOWL \
--to=glynn@gclements.plus.com \
--cc=421246@posta.unizar.es \
--cc=linux-c-programming@vger.kernel.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 NNTP newsgroup(s).