More questions about casting function pointers ..
- From: Alfonso Morra <sweet-science@xxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 00:47:06 +0000 (UTC)
Hi,
I have two func ptr prototypes declared as :
typedef void (*VFP)(void) ; typedef int(MyCallback*)(enum_1, enum2, int, void*) ;
I hav a struct as ff:
typedef struct {
VFP mini_callback ;
VFP data_callback ;
...
}FunctorStruct ;I can assign a function ptr of type MyCallback to mini_callback or data_callback (after suitable casts to VFP).
Assuming i have function foo defined as ff:
int foo( FunctorStruct *fctor ) {
/* code here to call function pointed to by data_callback
assuming we know the function pointed to is of type
MyCallback */(MyCallback)fctor->data_callback( ONE, TWO, 100, NULL ) ; /* <- dosen't compile !*/
}
The compiler dosen't grok this. When I try to compile the above snippet, it (the compiler) barfs and issues the ff message: "'VFP' : too many arguments for call through pointer-to-function".
How do I call the function - cast to its correct type?
tkx
.
- Follow-Ups:
- Re: More questions about casting function pointers ..
- From: Barry Schwarz
- Re: More questions about casting function pointers ..
- From: Peter Nilsson
- Re: More questions about casting function pointers ..
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: Re: while (1) vs. for ( ;; )
- Previous by thread: confused abt file operations
- Next by thread: Re: More questions about casting function pointers ..
- Index(es):
Relevant Pages
|