Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс. e-mail:jobsmp@pochta.ru |
6.3.2.1 Lvalues, arrays, and function designators
...
4 Afunction 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’’.
6.5.2.2 Function calls
Constraints
1 The expression that denotes the called function77) shall have type
pointer to function returning void or returning an object type
other than an array type.
2 If the expression that denotes the called function has a type that
includes a prototype, the number of arguments shall agree with the
number of parameters. Each argument shall have a type such that its
value may be assigned to an object with the unqualified version
of the type of its corresponding parameter.Semantics
3 A postfix expression followed by parentheses () containing a
possibly empty, commaseparated list of expressions is a function
call. The postfix expression denotes the called function.
The list of expressions specifies the arguments to the function.
...
77) Most often, this is the result of converting an identifier that is a function designator.
a = sin(b);
a = (flag ? sin : cos )(b);
Может, конечно, я ошибаюсь, но как минимум один пример есть :-)
C99, EXAMPLE 2 к пункту 6.9.1
EXAMPLE 2 To pass one function to another, one might say
int f(void);
/* ... */
g(f);Then the definition of g might read
void g(int (*funcp)(void))
{
/* ... */
(*funcp)() /* or funcp() ... */
}or, equivalently,
void g(int func(void))
{
/* ... */
func() /* or (*func)() ... */
}