From owner-freebsd-hackers Sun Oct 26 04:05:11 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id EAA01425 for hackers-outgoing; Sun, 26 Oct 1997 04:05:11 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from lsd.relcom.eu.net (lsd.relcom.eu.net [193.124.23.23]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id EAA01418 for ; Sun, 26 Oct 1997 04:05:05 -0800 (PST) (envelope-from ache@lsd.relcom.eu.net) Received: (from ache@localhost) by lsd.relcom.eu.net (8.8.7/8.8.7) id PAA03624; Sun, 26 Oct 1997 15:03:42 +0300 (MSK) (envelope-from ache) Date: Sun, 26 Oct 1997 15:03:07 +0300 (MSK) From: =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= X-Sender: ache@lsd.relcom.eu.net To: Wolfgang Helbig cc: hackers@FreeBSD.ORG Subject: Re: cvs commit: src/gnu/usr.bin/diff system.h In-Reply-To: <199710261149.MAA07531@rvc1.informatik.ba-stuttgart.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Sun, 26 Oct 1997, Wolfgang Helbig wrote: > > ache 1997/10/22 19:22:52 PDT > > > > Modified files: > > gnu/usr.bin/diff system.h > > Log: > > Add (unsigned char) cast to ctype macros > > > > Revision Changes Path > > 1.4 +5 -5 src/gnu/usr.bin/diff/system.h > > Should all char arguments to all ctype macros (isspace, isdigit > ...) in our source tree be cast to unsigned char? > > Quite a lot of them aren't. Those ctype macros are pain. General rule is that only EOF,0..255 range is allowed per POSIX and ANSI. It means that ctype(char) is illegal if char have 8bit set, because negative sign extension happens. Possible workarounds: 1) If the program assumes ASCII-only, test isascii() before any ctype macro call. 2) Add (unsigned char) cast to all ctype macros calls. Direct cast mask possible programmer errors like ctype(s) instead of ctype(*s). 3) Add -funsigned-char to CFLAGS, it seems to be best way unless some programs assume that char is signed somewhere. Many old BSD programs does. -- Andrey A. Chernov http://www.nagual.pp.ru/~ache/