#define conflict

I was going over some code written by a colleague today and noticed an issue.

She includes a windows header, WinError.h I believe. This header contains a define: #define FAILED(hr) ... . I can't remember the details of the rest of this macro.

Later in the .cpp file she defines const bool FAILED = true; and was probably unaware of the other usage of this in the header. The code compiles successfully and without warnings in MS Visual C++.

Now my question is what will happen? Will the compiler realize that the macro is unsuitable in this case and use the const bool vale or is it trying to use the macro and we simply haven't noticed the fallout from this yet?
#define is simple text replacement done by the preprocessor before the compiler is invoked. So the compiler doesn't know anything about macros.
However, the macro substitution isn't done here because it requires one argument, which hasn't been given.
Using all uppercase letter identifiers is a bad idea, by the way. Those should be considered reserved for macros.
Thanks Athar,

I was wondering why it had been working for so long.
Topic archived. No new replies allowed.