From: Thomas Stephens Date: 2009-10-20T01:23:14+09:00 Subject: [ruby-core:26166] [Bug #2234] Macros defined in win32.h cause some code to fail to compile. Bug #2234: Macros defined in win32.h cause some code to fail to compile. http://redmine.ruby-lang.org/issues/show/2234 Author: Thomas Stephens Status: Open, Priority: Normal ruby -v: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] 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. ---------------------------------------- http://redmine.ruby-lang.org