This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Maybe a Bug in Cygwin in using Pointers to class fuctions


"Ward Correll" <wardless@hotmail.com> writes:

> Maybe a bug in Cygwin! I think that this sorce code is correct in the Final
> ANSI\ISO standard on C++ so I think it could be cygwin. Please check it out
> for me in this simple code.

It's not a bug. Please see the discussion on pointer to member function
in a recent C++ book such as Stroustrup 3rd edition. Of course, the
best place is the ISO standard itself (cf: 8.3.3 [dcl.mptr]/2), but that
can be rather obtuse.

It's also a good idea to report what version of compiler you're using and
some system/OS info (gcc -v reports the compiler version).

>               case 1: pFunc = Mammal::Speak; break;
>               default: pFunc = Mammal::Move; break;
                                 ^^^^^^

> BASH.EXE-2.02$ c++ -o try try.cpp
> test.cpp: In function `int main()':
> test.cpp:66: assuming & on `Mammal::Speak'
> test.cpp:67: assuming & on `Mammal::Move'
> =====================================================================
> I know I want the fuction pointer to assume on Mammal::Speak or Mammal::Move
> when meets some conditions as you see. But cygwin won't let me do that.
> Anyway to force compiling?

The compiler gave you the answer, so use it! (hint: Mammal::Speak -->
&Mammal::Speak).

Followup to a C++ forum please.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]