Richard Heathfield <> writes:
> said:
>> Does anyone know whether the (*) is optional around the function
>> pointer name when it is part of an argument list, e.g.
You mean parameter list, not argument list. An argument list is the
list of expressions in a function call.
>> int f(int fn(int))
>> {
>> return fn(5);
>> }
>>
>> ?
>
> Believe it or not, it *is* optional. 3.2.2.1 of C89 reads in part:
> "A function designator is an expression that has function type.
> Except when it is the operand of the sizeof operator /25/ 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 .''"
Yes, but that's not the section that says it's optional. The text you
quoted says that the "*" is optional in a function call, not in a
function declaration.
The relevant paragraph is C99 6.7.5.3p8:
A declaration of a parameter as "function returning _type_" shall
be adjusted to "pointer to function returning _type_", as in
6.3.2.1.
> And I don't mind admitting that my initial reaction was "no". But I
> was wrong.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"