This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libstdc++] numeric_limits.cc check the wchar_t limits facility
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: [libstdc++] numeric_limits.cc check the wchar_t limits facility
- From: Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>
- Date: Fri, 26 Oct 2001 22:34:58 +0200 (CEST)
- cc: Andreas Schwab <schwab at suse dot de>, gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
On Fri, 26 Oct 2001, Benjamin Kosnik wrote:
|whatever happened to just using
|numeric_limits<wchar_t>::is_signed()
|?
Maybe my first statement was misleading. I would like to check if the
value of the is_signed member of the numeric_limits<wchar_t> class is
correct. The problem is that I need a way to get at the signedness
of the wchar_t type in a different way to make a comparison. The value of
the is_signed member is manually set in os_defines.h for a specific
operating system if there is a deviation from the default of
signedness.
But there is no #define from the operationg system
like __CHAR_UNSIGNED__ for the signedness of the char type I
could employ to get at the signedness of the wchar_t type, I know of.
Additionally, according to the file os_defines.h for aix:
#if !defined(_AIX51) || !defined(__64BIT__)
#define __glibcpp_wchar_t_bits 16
#define __glibcpp_wchar_t_is_signed false
#endif
the signedness differs for different releases of the aix operating
system. Therefore, the appended code fragment could roughly work.
Hope this helps,
Peter Schmid
#ifdef __CHAR_UNSIGNED__
#define char_is_signed false
#else
#define char_is_signed true
#endif
void test_sign()
{
VERIFY( std::numeric_limits<char>::is_signed == char_is_signed );
//new
#if defined(aix) || defined(hpux)
VERIFY( std::numeric_limits<wchar_t>::is_signed == false);
#else
VERIFY( std::numeric_limits<wchar_t>::is_signed == true);
#endif
#endif
}