xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
5.2.2
"The first expression in the postfix expression is then
called the object expression, and the call
is as a member of the object pointed to or referred to."
Your dereferenced foo is not an A object , its an integer.
You code is not standard compliant C++.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Please not the above quote contains the text: "a member of the object".
A little example:
#include <iostream>
struct X
{
static void foo()
{
std::cout << "foo() called" << std::endl;
}
};
int main()
{
X x;
//Postfix exp on static?
(&x)->foo();
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I don't know what the C++ rules are for this syntax.
Is it any different from
x.foo();
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
return 0;
}
Well, would you say foo() here above is also
a member of the object? It is a member
of all the objects simultaneously (or rather, of
the class), as is the case with non-static
member functions.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I don't know , what would you say?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
By your "postfix expression" argument here above
there is not much difference between static and
non-static member functions.
Your original statement:
-------------------
1) A member function of a class is a static member function.
2) A member function of an object belongs to the instance of
the object it was called on.
-------------------
Why then, by your argument here above, is it possible
to call a postfix expression on it, seeing that postfix
expressions only apply to "members of objects"? And static
members are not "members of objects", but rather of classes (1)
No the C++ standard defines a nonstatic member function can
only be invoked on an Object.
Wrt. point 2, it depends on your definition of "belongs to", as
previously stated.
Kind regards,
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm not into all that standaresque postfix prefix nonsense anyway , all we
need to know for the sake of the discussion is the gwowens code is not
standard compliant code.
And it wasn't even close to solving the recurion problem.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx