由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Question: Given a pointer to a function
相关主题
Questions about c codeOne question about Void pointer
pointer to functionint (*b)[2]; 是什么意思?
请问可以这样定义struct吗?C++ 菜鸟问一个关于template 的问题。
about STL functor and function pointers问一声大牛,c++不用pointer怎么编程?
请问const myClass &src 和myClass const &src有什么区别?为啥允许这样的const设计
出个题考考大家:)function pointer 和 call-back function 有什么区别?
C++里get array size的问题 (转载)是不是题出错了?
又问几个c语言编程的题目boost::function 的 syntax 问题
相关话题的讨论汇总
话题: given话题: question话题: function话题: pointer话题: abc
进入Programming版参与讨论
1 (共1页)
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
2
don't think so.
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"?

1 (共1页)
进入Programming版参与讨论
相关主题
boost::function 的 syntax 问题请问const myClass &src 和myClass const &src有什么区别?
这两个地方是否需要typename?出个题考考大家:)
[合集] C++ template questionC++里get array size的问题 (转载)
c++ interview question又问几个c语言编程的题目
Questions about c codeOne question about Void pointer
pointer to functionint (*b)[2]; 是什么意思?
请问可以这样定义struct吗?C++ 菜鸟问一个关于template 的问题。
about STL functor and function pointers问一声大牛,c++不用pointer怎么编程?
相关话题的讨论汇总
话题: given话题: question话题: function话题: pointer话题: abc