From owner-freebsd-hackers Sun Oct 26 04:58:00 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id EAA03442 for hackers-outgoing; Sun, 26 Oct 1997 04:58:00 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from rvc1.informatik.ba-stuttgart.de (rvc1.informatik.ba-stuttgart.de [141.31.112.22]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id EAA03437 for ; Sun, 26 Oct 1997 04:57:55 -0800 (PST) (envelope-from helbig@Informatik.BA-Stuttgart.DE) Received: (from helbig@localhost) by rvc1.informatik.ba-stuttgart.de (8.8.7/8.8.5) id NAA07666; Sun, 26 Oct 1997 13:56:41 +0100 (MET) From: Wolfgang Helbig Message-Id: <199710261256.NAA07666@rvc1.informatik.ba-stuttgart.de> Subject: Re: cvs commit: src/gnu/usr.bin/diff system.h In-Reply-To: from "[______ ______]" at "Oct 26, 97 03:03:07 pm" To: ache@nagual.pp.ru (=?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?=) Date: Sun, 26 Oct 1997 13:56:40 +0100 (MET) Cc: hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL30 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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. isascii() is a non ISO-C extension. So better yet we change the program in question to make it independent of this bogus assumption. > 2) Add (unsigned char) cast to all ctype macros calls. Direct cast mask > possible programmer errors like ctype(s) instead of ctype(*s). 2a) Pass an unsigned char (or int with its value in EOF, 0..UCHAR_MAX) right away, i. e. change the definition ``char *foo'' to ``unsigned char *foo'' whenever possible. > 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. This makes our source depend on a non portable feature of gcc, which I think should be avoided. So I suggest to adopt method 2) and 2a). Wolfgang