Re: 'C' Operators precedence

Peter Horton (
Wed, 20 May 1998 20:01:51 +0100 (BST)

On Wed, 20 May 1998, Hartmut Niemann wrote:

> >WRONG. See ANSI C standard section Function Calls: `The
> >expression that denotes the called function shall have type pointer to
> >function...', or Example 2 following section 6.7.1, which explicitly
> >shows that (*funcp)() is equivalent to funcp(), when funcp is declared
> >as int (*funcp)(void).
> Somewhere I read something like:
> C operator precedence, practical subset:
> (1) * and / precede + and -
> (2) everything else will be grouped by ( and )
> ('Practical C programming' from O'Reilly??)
> You don't assume that everybody understands
> funcp()
> as an abbreviation of
> (* funcp)()
> do you? At least the second one makes clear that funcp is not a function
> defined.
> So even if ANSI, POSIX and the gcc and it's manual agree, that the first
> (funcp() without parentheses) is legal, does it make sense to use this
> form?
> Hartmut

Surely it is more sensible. I don't read the standards or anything, but
from my humble understanding you can use the name of a declared function
as a pointer, so it makes sense that you should be able to call a function
using a pointer using exactly the same syntax.

int fruit;

void lemons(void)

int main()
void (*lemons_alias)(void);

/* using function name as pointer */

lemons_alias = lemons;

/* using function pointer as name */


return 0;

Just my 2 cents ...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to