[ https://issues.apache.org/jira/browse/XERCESC-1382?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Boris Kolpackov closed XERCESC-1382. ------------------------------------ Resolution: Invalid Compilers without bool are no longer supported. > Unreliable bool definition for compilers without bool type > ---------------------------------------------------------- > > Key: XERCESC-1382 > URL: https://issues.apache.org/jira/browse/XERCESC-1382 > Project: Xerces-C++ > Issue Type: Bug > Affects Versions: 2.6.0 > Environment: Solaris 2.8 SPARCompiler 4.2 > Reporter: Maciek Samsel > > For those compilers that do not recognize bool type yet the definition as it > is now (see below) will not cut: > #if defined(NO_NATIVE_BOOL) > #ifndef bool > typedef int bool; > #endif > #ifndef true > #define true 1 > #endif > #ifndef false > #define false 0 > #endif > #endif > That will cause compiler errors whenever you have declaration/definition of a > method with int and and another with bool. Compiler tries to build the same > signature and gets confused. It happend with: > XSerializeEngine.hpp: > XSerializeEngine& operator<<(int); > XSerializeEngine& operator<<(bool); > // NO GO! Compiler error if bool is typedef as alias to int > The better approach that will not confuse compiler without bool type is to > base bool on enumeration like that: > #if defined(NO_NATIVE_BOOL) > #ifndef bool > typedef enum {false=0, true=1} bool; > #endif > #endif > ... as long as we do not set enum as not convertible to integer (which was > possible at least with IBM VisualAge for C++ compiler). > Please adjust the file... as it compiles with proposed definition quite well. > There are also other approaches to deal with bool type or "smart enumeration > types". See how it was done in Java without enum but strict type checking - > it would be preferable way to apply to undefined bool type as other vendor > may define bool differently for libraries and it will cause conflicts with > current or proposed here solution in Xerces. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: c-dev-h...@xerces.apache.org