Re: More questions about casting function pointers ..
- From: "Peter Nilsson" <airia@xxxxxxxxxxx>
- Date: 30 Aug 2005 18:21:58 -0700
Alfonso Morra wrote:
>
> 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 !*/
((MyCallback) fctor->data_callback)( ONE, TWO, 100, NULL ) ;
> }
--
Peter
.
- References:
- More questions about casting function pointers ..
- From: Alfonso Morra
- 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: More questions about casting function pointers ..
- Next by thread: Re: More questions about casting function pointers ..
- Index(es):