o**f 发帖数: 76 | 1 Question: Given a pointer to a function, can you find out which function it
is? Thx in advanced!
Example:
typedef void (*foo)();
void abc();
... ...
foo f_ = abc;
... ...
now if f_ is used later, can we tell its name is "abc"? |
c****e 发帖数: 1453 | |
o**f 发帖数: 76 | 3 Guess so. Thank you.
【在 c****e 的大作中提到】 : don't think so.
|
c********x 发帖数: 84 | 4 you can't, but you can tell it from its address. |
j****g 发帖数: 597 | 5 you can't but you can write
cout << "this is abc" << endl;
in your function. :) |
c********x 发帖数: 84 | 6
it
Of Course you can:
if ( f_ == &abc ) {....}
【在 o**f 的大作中提到】 : Question: Given a pointer to a function, can you find out which function it : is? Thx in advanced! : Example: : typedef void (*foo)(); : void abc(); : ... ... : foo f_ = abc; : ... ... : now if f_ is used later, can we tell its name is "abc"?
|