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 3 1515
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
On Wed, 31 Aug 2005 00:47:06 +0000 (UTC), Alfonso Morra
<sw***********@the-ring.com> wrote: Hi,
I have two func ptr prototypes declared as :
typedef void (*VFP)(void) ; typedef int(MyCallback*)(enum_1, enum2, int, void*) ;
I hope you meant (*MyCallback).
<<Remove the del for email>>
Barry Schwarz wrote: On Wed, 31 Aug 2005 00:47:06 +0000 (UTC), Alfonso Morra <sw***********@the-ring.com> wrote:
Hi,
I have two func ptr prototypes declared as :
typedef void (*VFP)(void) ; typedef int(MyCallback*)(enum_1, enum2, int, void*) ;
I hope you meant (*MyCallback).
Yup. Typo. sorry about that should be :
typedef int (*MyCallback)(enum_1, enum2, int, void*) ;
<<Remove the del for email>> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: He Shiming |
last post by:
Hi,
I'm having a little bit of trouble regarding pointer casting in my program.
I don't understand why the following two cases produce different results.
Case 1:
IInterface *pInterface = new...
|
by: Marc Thrun |
last post by:
Hello,
I've got a few questions:
1) Given the two structs
struct A {
int x;
};
and
|
by: AzizMandar |
last post by:
C++ Event Coding Questions
I have done some simple programs in C++ and read a lot of good C++
books (Including The C++ Programing Language, and C++ Primer) I am
trying to understand and...
|
by: Jess |
last post by:
Hello,
It seems both static_cast and dynamic_cast can cast a base class
pointer/reference to a derived class pointer/reference. If so, is
there any difference between them?
In addition, if I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |