From owner-svn-src-all@FreeBSD.ORG Thu Sep 3 13:25:27 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B74601065670 for ; Thu, 3 Sep 2009 13:25:27 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 783018FC08 for ; Thu, 3 Sep 2009 13:25:27 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 9C1276D41B; Thu, 3 Sep 2009 13:25:26 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 749B3844B4; Thu, 3 Sep 2009 15:25:26 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Joerg Sonnenberger References: <200909020456.n824uUqQ082136@svn.freebsd.org> <20090902070808.GA1290@arthur.nitro.dk> <20090902084002.GA17325@nagual.pp.ru> <867hwgcwvo.fsf@ds4.des.no> <20090903084325.GA65192@nagual.pp.ru> <86zl9c9z05.fsf@ds4.des.no> <20090903115416.GB448@britannica.bec.de> Date: Thu, 03 Sep 2009 15:25:26 +0200 In-Reply-To: <20090903115416.GB448@britannica.bec.de> (Joerg Sonnenberger's message of "Thu, 3 Sep 2009 13:54:16 +0200") Message-ID: <86vdk0upmh.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r196752 - head/lib/libc/stdtime X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2009 13:25:27 -0000 Joerg Sonnenberger writes: > Dag-Erling Sm=C3=B8rgrav writes: > > @@ -65,6 +65,15 @@ > > .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" > > .It "\&036\ RS \t037\ US \t177\ DEL" > > .El > > +.Pp > > +.Em NOTE : > > +if the value passed to the > > +.Fn iscntrl > > +function is a > > +.Vt signed char , > > +as is usually the case, it must be cast to an > > +.Vt unsigned char > > +to avoid sign-extension errors. > > .Sh RETURN VALUES > > The > > .Fn iscntrl > This is actually not good enough. ISO C doesn't specify whether plain > char is signed or unsigned. This is FreeBSD. Our char is signed. On systems where it isn't (IRIX is the only one I know of), the cast is a no-op. > Also, isascii is the only exception to this rule, so the change for that > is wrong. No. The fact that isascii() accidentally returns the correct answer even in the absence of a cast is irrelevant. Passing a signed char to isascii() invokes undefined behavior. 7.4 Character handling 1 The header declares several functions useful for classifying and mapping characters.166) In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no