Prev: iterator invalidation guarantees in tr1::unordered_map
Next: compilation error when Base Constructor calling pure virtual method
From: John Shaw on 9 Jul 2010 23:06 I have verified that WCHAR_MAX and USHORT_MAX are defined to have the same value specified by MinGW 4.4.0. // Quick check of values std::cout << "WCHAR_MAX = " << WCHAR_MAX << std::endl; std::cout << "USHRT_MAX = " << USHRT_MAX << std::endl; Prints the Output WCHAR_MAX = 65535 USHRT_MAX = 65535 Could anyone explain why the G++ (GCC) preprocessor says they are not equal? // defined in "MinGW-4.4.0/wchar.h" #define WCHAR_MAX 0xffff // defined in "MinGW-4.4.0/limits.h" #define USHRT_MAX 0xffff // The following should not be causing #error to be processed #if (WCHAR_MAX != USHRT_MAX) #error *** (WCHAR_MAX != USHRT_MAX) THIS SHOLD NOT BE TRUE *** #endif Compiler Output error: #error *** (WCHAR_MAX != USHRT_MAX) THIS SHOLD NOT BE TRUE *** -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: Francis Glassborow on 10 Jul 2010 04:15 John Shaw wrote: > I have verified that WCHAR_MAX and USHORT_MAX are defined to have the > same value specified by MinGW 4.4.0. > > // Quick check of values > std::cout << "WCHAR_MAX = " << WCHAR_MAX << std::endl; > std::cout << "USHRT_MAX = " << USHRT_MAX << std::endl; > > Prints the Output > WCHAR_MAX = 65535 > USHRT_MAX = 65535 > > Could anyone explain why the G++ (GCC) preprocessor says they are not > equal? > > // defined in "MinGW-4.4.0/wchar.h" > #define WCHAR_MAX 0xffff > > // defined in "MinGW-4.4.0/limits.h" > #define USHRT_MAX 0xffff > > // The following should not be causing #error to be processed > #if (WCHAR_MAX != USHRT_MAX) > #error *** (WCHAR_MAX != USHRT_MAX) THIS SHOLD NOT BE TRUE *** > #endif > > Compiler Output > error: #error *** (WCHAR_MAX != USHRT_MAX) THIS SHOLD NOT BE TRUE *** > I think you need to show us the complete code so that we can see which header files you include in the translation unit. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
From: anand on 11 Jul 2010 18:52
On Jul 10, 10:06 am, John Shaw <shaw.joh...(a)gmail.com> wrote: > I have verified that WCHAR_MAX and USHORT_MAX are defined to have the > same value specified by MinGW 4.4.0. > > // Quick check of values > std::cout << "WCHAR_MAX = " << WCHAR_MAX << std::endl; > std::cout << "USHRT_MAX = " << USHRT_MAX << std::endl; > > Prints the Output > WCHAR_MAX = 65535 > USHRT_MAX = 65535 > > Could anyone explain why the G++ (GCC) preprocessor says they are not > equal? > > // defined in "MinGW-4.4.0/wchar.h" > #define WCHAR_MAX 0xffff > > // defined in "MinGW-4.4.0/limits.h" > #define USHRT_MAX 0xffff > > // The following should not be causing #error to be processed > #if (WCHAR_MAX != USHRT_MAX) > #error *** (WCHAR_MAX != USHRT_MAX) THIS SHOLD NOT BE TRUE *** > #endif > > Compiler Output > error: #error *** (WCHAR_MAX != USHRT_MAX) THIS SHOLD NOT BE TRUE *** > Did you try printing the values of WCHAR_MAX and USHRT_MAX right before or after the #error message so that we can make sure it is in fact the same values that's printed in your quick check? -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |