Connecting Tech Pros Worldwide Forums | Help | Site Map

Re: (part 7) Han from China answers your C questions

Nick Keighley
Guest
 
Posts: n/a
#1: Nov 2 '08
this poster tends to post with low information content
but high abuse content.


On Nov 2, 6:30*am, Nomen Nescio <nob...@dizum.comwrote:
Quote:
lancer6...@yahoo.com said:
<snip>
Quote:
Quote:
[i] saw a function header defined as:
>
Quote:
int Function(int value1, int value2, (int *A)(void *A1, int *A2, void
*A3), void *A3)
This specifies that parameter A is a pointer to a function
Quote:
Quote:
and the function is called by
>
Quote:
Function(value1, value2, A, A3);
'A' would be the name of a function. C automatically converts the name
into
a pointer to a function. The term used in the standard is "decays to
a
function pointer"
Quote:
Quote:
Is the "(int *A)(void *A1, int *A2, void *A3)" in the function header
equivalent to passing a function (A) to another function (Function)?
it specifies that the parameter is a function pointer
Quote:
Practically speaking, yes. In CLC-talk, no. Numerous semanticists,
postmodernists,
<snip>

your word salad seems more PoM than anything else I've
seen recently on clc.

Quote:
Something to think about: If "(int *A)(void *A1, int *A2, void *A3)"
were replaced by "int A[]", would an entire array be passed to
Function() or something else?
>
Quote:
If so, how are the arguments to A passed into Function when Function
is called?
>
They're not, at least not in the sense you probably think.
ok. It is specified that the parameter is a pointer to a function.
The parameters aren't passed here. You needd to look at the call
to A that, presumably, appears in Function().

<snip nonsense>


--
Nick Keighley

Barry Schwarz
Guest
 
Posts: n/a
#2: Nov 2 '08

re: Re: (part 7) Han from China answers your C questions


On Sun, 2 Nov 2008 06:15:20 -0800 (PST), Nick Keighley
<nick_keighley_nospam@hotmail.comwrote:
Quote:
>this poster tends to post with low information content
>but high abuse content.
>
>
>On Nov 2, 6:30*am, Nomen Nescio <nob...@dizum.comwrote:
Quote:
>lancer6...@yahoo.com said:
>
><snip>
>
Quote:
Quote:
[i] saw a function header defined as:
>>
Quote:
int Function(int value1, int value2, (int *A)(void *A1, int *A2, void
*A3), void *A3)
>
>This specifies that parameter A is a pointer to a function
>
Quote:
Quote:
and the function is called by
>>
Quote:
Function(value1, value2, A, A3);
>
>'A' would be the name of a function. C automatically converts the name
>into
>a pointer to a function. The term used in the standard is "decays to
>a
>function pointer"
Actually the word decay does not appear in the standard at all.
6.3.2.1-4 says "A function designator is an expression that has
function type. Except when it is the operand of the sizeof operator or
the unary & operator, a function designator with type ‘‘function
returning type’’ is converted to an expression that has type ‘‘pointer
to function returning type’’.


--
Remove del for email
Closed Thread