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

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
A
About on SuperTechFans
Vercel News
Vercel News
B
Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
腾讯CDC
D
Docker
V
Visual Studio Blog
博客园 - 叶小钗
The Cloudflare Blog
Jina AI
Jina AI
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏

博客园 - 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);

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