From owner-freebsd-current@FreeBSD.ORG Sun Jul 13 11:47:01 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 A935337B401 for ; Sun, 13 Jul 2003 11:47:01 -0700 (PDT) Received: from fafoe.narf.at (chello212186121237.14.vie.surfer.at [212.186.121.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD17143F85 for ; Sun, 13 Jul 2003 11:47:00 -0700 (PDT) (envelope-from stefan@fafoe.narf.at) Received: from wombat.fafoe.narf.at (wombat.fafoe.narf.at [192.168.2.102]) by fafoe.narf.at (Postfix) with ESMTP id EFEF93FA8; Sun, 13 Jul 2003 20:46:54 +0200 (CEST) Received: by wombat.fafoe.narf.at (Postfix, from userid 1001) id 16F005E; Sun, 13 Jul 2003 20:46:51 +0200 (CEST) Date: Sun, 13 Jul 2003 20:46:51 +0200 From: Stefan Farfeleder To: David Leimbach Message-ID: <20030713184651.GB586@wombat.fafoe.narf.at> References: <20030713000559.28c18be6.kabaev@mail.ru> <20030713044331.GA89785@crodrigues.org> <20030713152154.GA96653@stack.nl> <20030713.121125.54936166.imp@bsdimp.com> <6B36552C-B55F-11D7-BE3B-0003937E39E0@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6B36552C-B55F-11D7-BE3B-0003937E39E0@mac.com> User-Agent: Mutt/1.5.4i cc: freebsd-current@freebsd.org 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:47:01 -0000 On Sun, Jul 13, 2003 at 01:25:45PM -0500, David Leimbach wrote: > > 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) >= 0 as well. Is the assumption that > >: (unsigned type)(-1) is never zero valid? > > > >yes. There are no known machines where -1 == 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, > and that > some of that is implementation/platform dependant. You seem to be confused. While signed integers certainly can use the one's complement representation, the conversion of an negative value to an unsigned type is a different matter. The relevant quote from C99 is: 6.3.1.3 Signed and unsigned integers 2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.49) Regards, Stefan Farfeleder