Backport #2234
closedMacros defined in win32.h cause some code to fail to compile.
Description
=begin
The Windows-only win32.h defines some macros which map Microsoft's _foo functions to functions of the same name, but without the underscore. By making these macros, there is a possibility that the preprocessor can perform macro-substitution where it was not intended.
As an example, consider this macro definition in win32.h:
#ifndef finite
#define finite(x) _finite(x)
#endif
Given the attached example code, when the struct's member variable, finite, is initialized in the initializer list, the preprocessor interprets finite(0) as a call to the macro, finite(x), and replaces it with _finite(0). The C++ compiler then attempts to initialize the member, _finite, to 0, and there is a compilation error (because the struct does not have a member named _finite).
Please consider replacing these macros with inline functions. The resulting assembled code should be equivalent, and the inline function both preserves type-safety and prevents namespace polution.
=end
Files
Updated by naruse (Yui NARUSE) over 14 years ago
- Status changed from Open to Closed
=begin
Fixed by r25408
=end