What does this mean by variable define in C [duplicate]

▼魔方 西西 提交于 2020-02-05 09:40:26

问题


can you guys tell me, what does this mean in C?

 #define Privileged_Data
 Privileged_Data static int dVariable

Is it specific meaningful for Compiler to address variable?


回答1:


This is just a macro Privileged_Data doing nothing. The compiler will not even see it after the preprocessor pass.

It's probably a readability or company standards decision to tag some variables like this.




回答2:


A preprocessor macro can be defined without an associated value. When that is the case, the macro is substituted with nothing after preprocessing.

So given this:

#define Privileged_Data

Then this:

Privileged_Data static int dVariable

Becomes this after preprocessing:

static int dVariable

So this particular macro has no effect on the program, and was probably put in place for documentation purposes.



来源:https://stackoverflow.com/questions/53520289/what-does-this-mean-by-variable-define-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!