Path: utzoo!attcan!uunet!seas.gwu.edu!jeff From: jeff@seas.gwu.edu (Jeff Schilling) Newsgroups: comp.lang.c++ Subject: Resolving function pointer type mismatch ? Message-ID: <1686@sparko.gwu.edu> Date: 22 Mar 90 15:18:58 GMT Reply-To: jeff@seas.gwu.edu (Jeff Schilling) Distribution: na Organization: The George Washington University, Washington D.C. Lines: 45 Howdy, I have a class defined with a member that is a function pointer, like this: class foo { int (*keytest)(void *,void *) . . public: foo(); }; The idea is to have a pointer to a comparison function a la [str,mem]cmp to perform a comparison. The problem: I am using Zortech C++ 2.0 and in my constructor, I say foo() { keytest = &strcmp; } The compiler complains with a message of ZTCPP1 -oc:temp.tmp idxcoll keyTest = &strcmp; ^ "idxcoll.cpp", line 13 Syntax error: type mismatch Had: ,) returning> and: ,) returning> --- errorlevel 1 My question is, is the compiler complaining about the C++ versus C function type, or the arguments? The Zortech reference manual states that "both the arguments and return type must exactly match those of the function pointer _EXACTLY_" So, what will it be? Thanx in advance. jeff +---------------------------------------------------------------------------+ | Jeff Schilling School of Engineering Computing Facility | | jeff@seas.gwu.edu George Washington University | | uunet!gwusun!jeff Washington, DC 20009 | | (201) 994-6853 | | System Programmer | +---------------------------------------------------------------------------+