有一段程序如下:
void func()
{
//to do
}
union Function_Pointer
{
void (*pointer)();
char bytes[sizeof(void *)];
}Address;
Address.pointer=func;1。然后此时Address.bytes[0],Address.bytes[1]里放的就是选择子(段基址), Address.bytes[2],Address.bytes[3]里放的就是偏移地址?
2。为什么?
3。有没有什么其他方法得到func()这个函数的段基址和偏移地址
?怎么得到?
void func()
{
//to do
}
union Function_Pointer
{
void (*pointer)();
char bytes[sizeof(void *)];
}Address;
Address.pointer=func;1。然后此时Address.bytes[0],Address.bytes[1]里放的就是选择子(段基址), Address.bytes[2],Address.bytes[3]里放的就是偏移地址?
2。为什么?
3。有没有什么其他方法得到func()这个函数的段基址和偏移地址
?怎么得到?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货