Reputation: 13
I have a question about the definition in c code as bellow.
#define DESC(x) 1
#if DESC("abc cdef")
.... some implementation or declaration
#endif
What exactly does the macro DESC("abc cdef") mean? Does it stand for a sub module? It this is true, where can I refer to the information about it?
Thank you for go through this question.
Upvotes: 1
Views: 148
Reputation: 1547
This is a function-like macro, which takes in x
as a parameter and returns 1
.
Upvotes: 1
Reputation: 90015
DESC(x)
is a function-like preprocessor macro. In your case, it ignores its input and always replaces it with an integer literal 1
.
I don't know for certain why it's being used this way, but I suspect the author wanted:
#if
... #endif
).(Most people would use comments for #1, but with just comments sometimes #2 is unclear.)
Upvotes: 3