#define FIND(struc,e) (size_t)&(((struc*)0)->e)
来源:互联网 发布:学生网络欺凌事件 编辑:程序博客网 时间:2024/04/28 07:05
#include <stdio.h>typedef struct TagTest{ int a; char b[20]; double ccc;}test;#define FIND(struc,e) (size_t)&(((struc*)0)->e)int main(){ printf("%d\n",FIND(test,a)); printf("%d\n",FIND(test,b)); printf("%d\n",FIND(test,ccc)); return 0;}
[root@localhost ccy]# ./a.out
0
4
24
0 0
- 如何解释 #define FIND(struc, e) (size_t) &(((struc*) 0)->e)
- #define FIND(struc,e) (size_t)&(((struc*)0)->e)
- #define OFFSET(struc, m) (size_t)(&(((struc*)0)->m))
- 用一个宏定义FIND求一个结构体struc里某个变量相对struc的偏移量
- Struc框架初学错误
- struc 字节对齐
- struc,union,class的内存对齐方式
- 关于内核数据结构struc list_head的用法。
- 用一个宏定义FIND求一个结构体struct里某个变量相对struc的编移量
- 用一个宏定义FIND求一个结构体struct里某个变量相对struc的编移量.
- 【程序员面试宝典】【疑问】6.1宏定义 用一个宏定义FIND求一个结构体struct里某个变量相对struc的编移量
- PE文件详解八:IMAGE_BASE_RELOCATION STRUC基址重定
- struct 和typedef struc的t什么区别
- e
- E
- E
- e
- e
- 【备忘】一个标准的win32窗口框架
- Esper学习之四:Context
- JMS
- WPF基础路由事件学习
- android线程
- #define FIND(struc,e) (size_t)&(((struc*)0)->e)
- SPI子系统一
- hdu 1171 Big Event in HDU
- Eclipse去除js错误
- 体会分函数:输入10个整数,将其中最小的数与第一个数对换,把最大的数与最后一个数对换。
- GBK/Unicode
- Java桌面程序打包成exe可执行文件
- Oracle 中如何判断时间类型Date是否为空
- 磁盘阵列RAID 5与6的比较