惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
美团技术团队
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
月光博客
月光博客
宝玉的分享
宝玉的分享
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research
A
About on SuperTechFans
J
Java Code Geeks
博客园_首页
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
Vercel News
Vercel News
博客园 - 聂微东

博客园 - Cheney Shen

如果将 macOS Mojave 降级为 macOS Sierra 或者更低版本 pip源提示“not a trusted or secure host” 解决 Window系统下MongoDB安装及远程访问 Windows下安装appium桌面版和命令行版 Command 'java' not found during running appium sudo npm install -g cnpm --registry=https://registry.npm.taobao.org Pycharm 中错误ImportError: No module named appium CURL并发测试POST和DELETE请求 curl如何发起DELETE/PUT请求?(备忘) Ubuntu 11.10下安装配置Zend Studio 9.0破解版详细步骤 iphone开源汇总(转) iphone开源汇总(转) python中的cursor[备忘] 在main函数执行之前和执行之后执行的方法 Intel苹果电脑Mac+Win+Linux多重系统启动(+公用分区)终极解决方案(备忘) IGT笔试题,正整数N等于M个不同的正整数之和的问题 为特定应用程序关闭恢复窗口功能 [Mac OS X Lion][转] System Events, Key Code and Keystroke from Doug's AppleScripts Mac下Perl脚本如何运行
如何通过一个结构体成员变量的地址找到该结构体的首地址?[...
Cheney Shen · 2011-10-28 · via 博客园 - Cheney Shen

Linux内核代码里的一个宏(Linux内核里很多结构体之间是通过某一成员变量相互寻址的),感觉挺巧妙。大概意思是:

#define get_addr(type, member, mem_addr)    (type*)(mem_addr - &(((type*)0)->member)) 

typedef struct{

int a;

int b;

int c;

}test_t test;

addr = get_addr(test_t, c, &test.c);

这样可以绕过字节对齐问题。