V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
borisz
V2EX  ›  C

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

  •  
  •   borisz · Oct 23, 2021 · 3157 views
    This topic created in 1647 days ago, the information mentioned may be changed or developed.

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

    3 replies    2021-10-23 18:35:32 +08:00
    Mithril
        1
    Mithril  
       Oct 23, 2021
    你可以直接看预处理的输出结果,不过头文件不多还行,不然头文件展开以后就是一大坨,更不好看。
    c0xt30a
        2
    c0xt30a  
       Oct 23, 2021   ❤️ 1
    `gcc -E x.c > dumped.c`
    Origami404
        3
    Origami404  
       Oct 23, 2021 via Android   ❤️ 1
    有个玩意叫 unifdef ,听说 linux 内核开发者都在用🐶
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3205 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 62ms · UTC 13:39 · PVG 21:39 · LAX 06:39 · JFK 09:39
    ♥ Do have faith in what you're doing.