[ http://issues.apache.org/jira/browse/XERCESC-1382?page=comments#action_61095 ] Gareth Reakes commented on XERCESC-1382: ----------------------------------------
Hi, I don't feel comfortable committing this path as I don't have the multi platform knowledge requided to be sure it will work on the huge number of platforms we support. Could you post to the list with your opinion and we can kick off a discussion and get everyone elses view? Cheers, Gareth > Unreliable bool definition for compilers without bool type > ---------------------------------------------------------- > > Key: XERCESC-1382 > URL: http://issues.apache.org/jira/browse/XERCESC-1382 > Project: Xerces-C++ > Type: Bug > 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. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]