Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Oct 1997 16:07:55 +0300 (MSK)
From:      =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru>
To:        Wolfgang Helbig <helbig@Informatik.BA-Stuttgart.DE>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: cvs commit: src/gnu/usr.bin/diff system.h
Message-ID:  <Pine.BSF.3.96.971026155824.4417A-100000@lsd.relcom.eu.net>
In-Reply-To: <199710261256.NAA07666@rvc1.informatik.ba-stuttgart.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 26 Oct 1997, Wolfgang Helbig wrote:

> isascii() is a non ISO-C extension. So better yet we change the
> program in question to make it independent of this bogus assumption.

isascii() conforms to ISO 9899: 1990 (``ISO C'')
Sometimes it is not bogus, i.e. when you check DNS name, you need only
ASCII subset for isalpha()

> > 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.

It is more difficult than 2) and may cause prototypes mismatch and
assignment types conflict but now allows programmer errors of course.

> > 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.

It is beter way for 3rd party software like GNU one since require minimal
source changes. 

> So I suggest to adopt method 2) and 2a).

I suggest to adopt the method which best fit to particular situation.

-- 
Andrey A. Chernov
<ache@nietzsche.net>
http://www.nagual.pp.ru/~ache/




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.971026155824.4417A-100000>