- 论坛徽章:
- 2
|
回复 #40 iLRainyday 的帖子
我也不知道在哪下到的电子版 …… 可能到处收刮的
function pointers and data pointers may have significantly differnet representations,including different sizes.
嗯, 这就和我以前理解的相同了。
in standard C,void * can be used as a generic object pointer,but there is no generic funciton pointer.
这里好像不对。
c89 6.3.4 Cast operators p45
...
A pointer to a function of one type may be converted to a pointer to a function of another
type and back again; the result shall compare equal to the original pointer. If a converted
pointer is used to call a function that has a type that is not compatible with the type of the
called function. the behavior is undefined.
...
也就是说, 随便哪一个pointer to function都可以作为generic function pointer,只要在使用前转型为原有的类型就没有问题。 |
|