且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在结构内部定义宏背后的逻辑是什么?

更新时间:2022-06-21 04:53:51

我认为这不是***实践",应该将(用于值的)定义保持在结构附近,而不是在结构内部.

i think, this is no "best practice", one should keep the defines (for values) near the struct, but not inside the struct.

(***是枚举和typedef常量,因此,如果输入不正确,编译器可能会发出警告).

(Even better would be to enum and typedef the constants, so a compiler could warn if not typed properly).

另一种情况是TH_OFF()宏隐藏"了另一个元素,因此也许可以将其放在此位置(带有适当的注释)

The TH_OFF() macro is another case, where it "hides" another element, so maybe it could be put at this position (with an appropriate comment)