> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of Ben Combee
> Sent: Tuesday, August 12, 2003 12:39 PM
> To: Palm Developer Forum
> Subject: RE: TblSetCustomDrawProcedure() - illegal implicit conversion
>
>
> At 02:25 PM 8/12/2003, Scott Johnson wrote:
> >From: Ben Combee [mailto:[EMAIL PROTECTED]
> > > C++ doesn't allow the implicit taking of a function pointer
> > > from a function bare name. That's what the error is saying.
> >
> >Ben, are you sure about that? My copy of Stroustrup 3rd Ed. (section
> >7.7) explicitly states the '&' is optional, and the compiler I'm
> >presently using (alas, for a non-Palm platform) is happy either way.
>
> I was wrong. C++ will allow implicit function-to-pointer
> conversion, as
> indicated by $4.3 in the ISO C++ (1999) standard.
>
> I think the error message was wrong -- it showed the types from the
> original conversion step, rather than the types that
> mismatched. I'll see
> if this still fails like this with the current compiler sources.
That's funny. I got the same error message a few days when passing in
an incorrectly-signatured DmCompareF function pointer to SomeFunc(). I
had defined it as such:
// My incorrectly-signatured DmCompareF:
Int16 BadCompareFunctionPatientDB( void* pRec1, void* pRec2, Int16
wSortType,
PatientRecordType* psortInfoRec1, //
CAUSES COMPILE ERROR
PatientRecordType* psortInfoRec2, //
CAUSE COMPILE ERROR
MemHandle hAppInfo );
I figured I could just cast the 'SortRecordInfoType*' into a
'PatientReocrdType*' to make the code more readable inside of my compare
function. However, I got an error message stating :
Error : function call 'SomeFunc( ..., {lval} short (void *, void *,
short, SortRecordInfoType *, SortRecordInfoType *, _opaque *))'
does not match
'SomeFunc(..., short (*)(void *, void *, short, SortRecordInfoType *,
SortRecordInfoType *, _opaque *))'
The solution was to define the signature as:
Int16 GoodCompareFunctionPatientDB( void* pRec1, void* pRec2, Int16
wSortType,
SortRecordInfoPtr psortInfoRec1,
SortRecordInfoPtr psortInfoRec2,
MemHandle hAppInfo );
This made the error message go away (well, after a half an hour of
hair-pulling).
-Jeff Ishaq
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/