KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I just had a redefine conflict in the project I'm working on and while tracing down why it's not happening on all platforms (turned out to be to order of includes), I stumbled upon the following behavior which I cannot explain. 1. compiles without warnings #define LIST_HEAD(a) { int a = 0; } #include <sys/queue.h> int main() { return 0; } 2. "macro redefined" warning #include <sys/queue.h> #define LIST_HEAD(a) { int a = 0; } int main() { return 0; } I would expect both cases to produce the warning, since there're no checks in <sys/queue.h> that would prevent a redefine. So why does the first case produces no warning, while the second one does? What I'm missing here? Btw: I get the same results on my Mac with clang and my Linux box with gcc.
Tags (comma-separated)
Save Edits
Cancel