9

c 语言条件编译宏太多, 有什么办法解决吗

 2 years ago
source link: https://www.v2ex.com/t/810041
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  C

c 语言条件编译宏太多, 有什么办法解决吗

  borisz · 9 小时 51 分钟前 · 634 次点击

嵌入式代码需要兼容的版本太多了, 同一个函数里面条件宏比代码逻辑还多了, 然后用 vscode 看代码头都大了, 大家有什么办法解决一下吗?

3 条回复    2021-10-23 18:35:32 +08:00

Mithril

Mithril   9 小时 36 分钟前

你可以直接看预处理的输出结果,不过头文件不多还行,不然头文件展开以后就是一大坨,更不好看。

c0xt30a

c0xt30a   9 小时 30 分钟前   ❤️ 1

`gcc -E x.c > dumped.c`

Origami404

Origami404   8 小时 54 分钟前 via Android

有个玩意叫 unifdef ,听说 linux 内核开发者都在用🐶

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK