misc/113256: _limits.h for some CPU has wrong definitions of
__UCHAR_MAX and __USHRT_MAX
kmatsui at t3.rim.or.jp
Sat Jun 2 14:20:22 UTC 2007
>Synopsis: _limits.h for some CPU has wrong definitions of __UCHAR_MAX and __USHRT_MAX
>Arrival-Date: Sat Jun 02 14:20:18 GMT 2007
>Originator: Kiyoshi Matsui
>Release: none (I use FreeBSD 6.2 on i386)
have wrong definitions of __UCHAR_MAX and __USHRT_MAX as:
#define __UCHAR_MAX 0xffU
#define __USHRT_MAX 0xffffU
The following header files also have the same wrong definitions.
(alpha support was removed)
These definitions may be used to define UCHAR_MAX and USHRT_MAX
respectively, in /usr/include/limits.h, on the FreeBSD system of the
corresponding CPU, hence UCHAR_MAX and USHRT_MAX are wrongly defined.
My port devel/mcpp (mcpp-2.6.4) was reported to fail to be built on
This is not a bug of mcpp, it is a bug of _limits.h of amd64 and others.
__UCHAR_MAX and __USHRT_MAX should be defined as:
#define __UCHAR_MAX 0xff
#define __USHRT_MAX 0xffff
In other words, 'U' suffix of '0xffU' and '0xffffU' should be removed.
On the other hand, the following headers have right definitions.
/usr/include/machine/_limits.h on i386 system
Also _limits.h for arm and sparc64 have right definitions of these
macros as well as the one for i386.
UCHAR_MAX and USHRT_MAX should be defined so as to be promoted to 'int',
if 'int' can represent all the values of 'unsigned char' and
'unsigned short' respectively. These should not be promoted to
For further informations see the following document of mine.
More information about the freebsd-bugs