From owner-freebsd-current@FreeBSD.ORG Sun Jul 13 11:24:43 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 C9E3C37B401 for ; Sun, 13 Jul 2003 11:24:43 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4466843FB1 for ; Sun, 13 Jul 2003 11:24:35 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.9/8.12.3) with ESMTP id h6DINucF001632; Sun, 13 Jul 2003 12:23:57 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 13 Jul 2003 12:23:52 -0600 (MDT) Message-Id: <20030713.122352.22176834.imp@bsdimp.com> To: jilles@stack.nl From: "M. Warner Losh" In-Reply-To: <20030713152154.GA96653@stack.nl> References: <20030713000559.28c18be6.kabaev@mail.ru> <20030713044331.GA89785@crodrigues.org> <20030713152154.GA96653@stack.nl> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: rodrigc@crodrigues.org cc: kabaev@mail.ru 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:24:44 -0000 : > 134 #define __glibcpp_signed(T) ((T)(-1) < 0) : #define __glibcpp_signed(T) (!((T)(-1) > 0)) Why not the simpler: #define __glibcpp_signed(T) ((T)(-1) <= 0) that way we have an overlap on the range of the two types, so we won't get a warning. We know for a fact that -1 != 0 for all known machine types (all machines are two's complement, or are required to behave as if they are two's complement, per the standard). (unsigned int) -1 == 0xffffffff (assuming 32-bit int). even on a one's complement's machine, without the standard conversion, the 'type punning' conversion of -1 would yield 0xfffffffe, which is still > 0. Warner