|
-
March 28th, 2008, 12:27 PM
#1
signal handling and function pointers.
I want to handle the interrupt signal, and when i do that, the function called to be dependent on whats the program's condition is. I mean that i want to print the result for the operation running when interupted even if it hasn't finish but this could vary between some operations so i need to choose the function to be called.
The problem here is that these functions i want to choose from are members of a class
and i cant declare a function pointer and then assign it to a member of that specific class
(ex . fncpty = &class.function). Any other ideas about it?
For handling the signal i use the signal function which takes signal and a function pointer, any alternatives to that either are welcomed.
Thanks in advance.
-
March 28th, 2008, 02:10 PM
#2
Re: signal handling and function pointers.
 Originally Posted by verbal
The problem here is that these functions i want to choose from are members of a classand i cant declare a function pointer and then assign it to a member of that specific class(ex . fncpty = &class.function). Any other ideas about it?
When dealing with a non-static member function, the correct terminology to use is object, not class. The reason why this is important is because a non-static member function needs an object to work with, not a class.
See this FAQ:
http://www.parashift.com/c++-faq-lit....html#faq-33.2
Regards,
Paul McKenzie
-
March 28th, 2008, 04:15 PM
#3
Re: signal handling and function pointers.
and the signal handling has no notion of objects, so I doubt you'll find a solution that works. Handling signals is more about function calls in exceptional cases when in C++ you would choose to throw an exception.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|