Closed nanis closed 9 years ago
Note that Visual Studio 2013 documentation has this to say:
In Visual C++4.2, the Standard C++ header files contained a typedef that equated bool with int. In Visual C++ 5.0 and later, bool is implemented as a built-in type with a size of 1 byte. That means that for Visual C++ 4.2, a call of
sizeof(bool)
yields 4, while in Visual C++ 5.0 and later, the same call yields 1. This can cause memory corruption problems if you have defined structure members of type bool in Visual C++ 4.2 and are mixing object files (OBJ) and/or DLLs built with the 4.2 and 5.0 or later compilers.The
__BOOL_DEFINED
macro can be used to wrap code that is dependent on whether or not bool is supported.
So, I am not sure if the unconditional definitions are necessary even on earlier platforms, but stdbool.h
was added in Visual Studio 2013:
... We also added the new headers
complex.h
,stdbool.h
,fenv.h
, andinttypes.h
, and added the implementations for all the functions declared in them.
Therefore, stdbool.h
can, and needs to be, safely included if _MSC_VER >= 1800
.
Thank you for the report! I have released 0.22 on CPAN which should fix this issue.
Thank you very much for the heads up.
src/dt_config.h has this:
which causes:
...\time-moment-0.21\src\dt_config.h(34) : error C2632: 'char' followed by 'bool' is illegal
...\time-moment-0.21\src\dt_config.h(34) : warning C4091: 'typedef ' : ignored on left of 'char' when no variable is declared
Removing the
#ifdef
guard around#include <stdbool.h>
solves the problem, but, of course, I do not know when it became OK to usestdbool.h
on this platform. I have