On Jun 17, 1:43 pm, Jess <w...@hotmail.comwrote:
Quote:
I just remembered another question. I think the declaration
Quote:
says p is a function that takes no argument and returns a pointer to
an int. What about the following?
Quote:
I think it says p is a pointer that points to a function taking no
argument and returns an int. Is this right?
Right.
Quote:
If so, does it mean
"*p()" always has "p" binding more tightly to the right?
The "operators" in the C++ declarations bind exactly as do the
operators in an expression. Generally speaking, operators which
appear to the right of the operand have higher precedance than
those binding to the left, and with those closer to the operand
being bound first. So something like "int* a[]" is an array of
pointer, and not a pointer to an array, and "int *p()" is a
function returning a pointer, and not a pointer to a function.
And something like "int (*p[])()" is an array of pointers to a
function returning int.
--
James Kanze (Gabi Software) email:
james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34