[LLVMdev] DataTypes.h for Visual C

Kenneth Boyd zaimoni at zaimoni.com
Sat Jul 3 12:15:11 PDT 2010

On 7/3/2010 7:59 AM, Jochen Wilhelmy wrote:
> has the advantage that you are forced to define __STDC_CONSTANT_MACROS
> on win32. If you then switch to another platform the project still compiles.
By using undefined behavior.  No thanks.

The C99/C1X standards, and the C++0X standard, are a direct 
contradiction regarding whether C++ mode should require 
__STDC_CONSTANT_MACROS for these macros to work.  (C99/C1X requires, 
C++0X doesn't).

Just because GCC's maintainers made the decision to follow C99/C1X 
regarding behavior of a header in C++, does not mean a workaround such 
as DataTypes.h should repeat this choice to force programs to use C++ 
undefined behavior (use of a macro reserved to the implementation, 
__STDC_CONSTANT_MACROS) to compile correctly.

(I'm not *positive* that using -D__STD_CONSTANT_MACROS on the command 
line is compliant [but it seems likely as otherwise the POSIX and 
C90/C99 standards are in direct contradiction and this hasn't been 
noticed for ~15 years], but I know that #define __STD_CONSTANT_MACROS 1 
in the source is undefined behavior.)


More information about the llvm-dev mailing list