Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2003 11:28:47 +1100
From:      Tim Robbins <tjr@FreeBSD.org>
To:        Craig Rodrigues <rodrigc@attbi.com>
Cc:        freebsd-standards@FreeBSD.org, kan@FreeBSD.org
Subject:   Re: WCHAR_MIN and WCHAR_MAX not defined in <wchar.h>
Message-ID:  <20030220112847.A36977@dilbert.robbins.dropbear.id.au>
In-Reply-To: <20030219223313.GA93707@attbi.com>; from rodrigc@attbi.com on Wed, Feb 19, 2003 at 05:33:13PM -0500
References:  <20030219223313.GA93707@attbi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 19, 2003 at 05:33:13PM -0500, Craig Rodrigues wrote:

> Hi,
> 
> On my -CURRENT system, WCHAR_MIN and WCHAR_MAX are not defined
> in <wchar.h>.
> 
> What should they be defined to?
> 
> On my Linux system, I see that they are defined as:
> 
> #define __WCHAR_MIN     (-2147483647l - 1l)
> #define __WCHAR_MAX     (2147483647l)
> 
> 2147483647 is equal to 0x7FFFFFFF.
> 
> In another library, I have seen them defined as:
> 
> # define WCHAR_MIN ((wchar_t) 0)
> # define WCHAR_MAX (~WCHAR_MIN)
> 
> 
> What are the correct values for FreeBSD?

The correct values are the same as Linux but without the 'l' suffix:

#define	WCHAR_MIN	(-2147483647 - 1)
#define	WCHAR_MAX	2147483647

The second definition of WCHAR_MIN and WCHAR_MAX is incorrect because it
uses casts in the expression; IIRC, it needs to be possible to use these
values in preprocessor #if statements:

#if WCHAR_MIN == 0
/* wchar_t is unsigned */
#endif

I'll add a definition of WCHAR_MIN and WCHAR_MAX to <wchar.h> as soon as I
can find a clean (non-polluting) way of doing it.


Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030220112847.A36977>