Subject: lib/31306: Incorrect definitions of UCHAR_MAX and USHRT_MAX
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <neil@daikokuya.co.uk>
List: netbsd-bugs
Date: 09/13/2005 13:10:01
>Number: 31306
>Category: lib
>Synopsis: Incorrect definitions of UCHAR_MAX and USHRT_MAX
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Sep 13 13:10:00 +0000 2005
>Originator: neil@daikokuya.co.uk
>Release: NetBSD 3.99.7
>Organization:
none
>Environment:
System: NetBSD duron.akihabara.co.uk 3.99.7 NetBSD 3.99.7 (GENERIC) #0: Sat Jul 30 12:56:56 JST 2005 root@duron.akihabara.co.uk:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
The definitions of UCHAR_MAX and USHRT_MAX in <limits.h> are U-suffixed
hexadecimal constants. This does not conform to the C standard (C90 and C99).
The standard requires they have the same type as would have integer-
promoted objects of type "unsigned char" and "unsigned short", i.e. type
"int". However with U suffixes the constants have type "unsigned int".
>How-To-Repeat:
>Fix:
Redefine as unsuffixed hex constants, which are always correct for the
integer promotions, regardless of the relative sizes of char, short and
int.