From owner-freebsd-current@FreeBSD.ORG Sun Jul 13 11:25:58 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5662337B404 for ; Sun, 13 Jul 2003 11:25:58 -0700 (PDT) Received: from smtpout.mac.com (A17-250-248-87.apple.com [17.250.248.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id A290A43F93 for ; Sun, 13 Jul 2003 11:25:57 -0700 (PDT) (envelope-from leimy2k@mac.com) Received: from mac.com (smtpin08-en2 [10.13.10.153]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id h6DIPo4U002683; Sun, 13 Jul 2003 11:25:50 -0700 (PDT) Received: from mac.com (adsl-78-178-166.jan.bellsouth.net [216.78.178.166]) (authenticated bits=0) by mac.com (Xserve/8.12.9/MantshX 2.0) with ESMTP id h6DIPlsq012844; Sun, 13 Jul 2003 11:25:47 -0700 (PDT) In-Reply-To: <20030713.121125.54936166.imp@bsdimp.com> References: <20030713000559.28c18be6.kabaev@mail.ru> <20030713044331.GA89785@crodrigues.org> <20030713152154.GA96653@stack.nl> <20030713.121125.54936166.imp@bsdimp.com> Mime-Version: 1.0 (Apple Message framework v578) Content-Type: text/plain; charset=BIG5; format=flowed Message-Id: <6B36552C-B55F-11D7-BE3B-0003937E39E0@mac.com> Content-Transfer-Encoding: quoted-printable From: David Leimbach Date: Sun, 13 Jul 2003 13:25:45 -0500 To: "M. Warner Losh" X-Mailer: Apple Mail (2.578) cc: rodrigc@crodrigues.org cc: kabaev@mail.ru cc: freebsd-current@freebsd.org cc: jilles@stack.nl Subject: Re: GCC 3.3.1, new warnings with X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jul 2003 18:25:58 -0000 On Sunday, July 13, 2003, at 1:11PM, M. Warner Losh wrote: > In message: <20030713152154.GA96653@stack.nl> > Jilles Tjoelker writes: > : The compiler moans about (T)(-1) >=3D 0 as well. Is the assumption = that > : (unsigned type)(-1) is never zero valid? > > yes. There are no known machines where -1 =3D=3D 0 for types of = different > signs. Further, the C standard says that it must behave as if it is a > two's complement machine, and I think that C++ says so too. > I am pretty certain you can do one's compliment in the C99 standard,=20 and that some of that is implementation/platform dependant. See section 6.2.6.2 of the C99 standard which enumerates the following 3 negative number representations: =A1Xthe corresponding value with sign bit 0 is negated (sign and=20 magnitude); =A1Xthe sign bit has the value-(2^N )(two=A1=A6s complement); =A1Xthe sign bit has the value-(2^N -1) (one=A1=A6s complement). further: "Which of these applies is implementation-defined, as is whether the=20 value with sign bit 1 and all value bits zero (for the first two), or=20 with sign bit and all value bits 1 (for one=A1=A6s complement), is a = trap=20 representation or a normal value. Inthe case of sign and magnitude and=20= one=A1=A6scomplement, if this representation is a normal value it is = called=20 a negative zero. " Yes... a negative 0. > Warner > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to=20 > "freebsd-current-unsubscribe@freebsd.org"