Re: C++ error: cannot convert "unsigned int A::*" to "unsigned int*" in return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/28/06, Erik  wrote:
3:    unsigned int j() const throw () {return A::j;}
4:    unsigned int * f() {return &A::j;}
In member function "unsigned int* B::f()":
cc_operators.cc:4: fel: cannot convert "unsigned int A::*" to "unsigned
int*" in return

If I change it to &(A::j) it works, but that should not be needed since
operator:: has highest precedence according to the book, right?

Hi.
 I don't know what exactly the C++ standard says and GCC thinks,
but I prefer to see the "&CLASSNAME::MEMBER" not as the
combination of parts "&" and "::", but as the whole, with the semantics
"give me a relative address of a member" .
 This explains, why, in the second case, the "&(C::M)" should be used.
But better post this question to "comp.lang.c++.moderated".

Regards,
Dima.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux