From owner-freebsd-hackers@FreeBSD.ORG Thu May 1 14:34:24 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E329C37B401 for ; Thu, 1 May 2003 14:34:24 -0700 (PDT) Received: from falcon.midgard.homeip.net (h76n3fls20o913.telia.com [213.67.148.76]) by mx1.FreeBSD.org (Postfix) with SMTP id 6FC5843FB1 for ; Thu, 1 May 2003 14:34:22 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: (qmail 51819 invoked by uid 1001); 1 May 2003 21:34:19 -0000 Date: Thu, 1 May 2003 23:34:18 +0200 From: Erik Trulsson To: Dag-Erling Smorgrav Message-ID: <20030501213418.GA42794@falcon.midgard.homeip.net> Mail-Followup-To: Dag-Erling Smorgrav , "Jacques A. Vidrine" , hackers@freebsd.org References: <20030501150713.GA34992@madman.celabo.org> <20030501152022.GC568@wombat.fafoe> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i cc: "Jacques A. Vidrine" cc: hackers@freebsd.org Subject: Re: incorrect enum warning? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 May 2003 21:34:25 -0000 On Thu, May 01, 2003 at 11:03:40PM +0200, Dag-Erling Smorgrav wrote: > Stefan Farfeleder writes: > > Because 0x80000000 > INT_MAX on 32-Bit architectures, 0x80000000 has > > type unsigned. But enumeration constants always have type int, that's > > why you're getting this warning. > > but 0x80000000 == INT_MIN on 32-bit two's complement systems... No. 0x80000000 has type unsigned int (assuming 32-bit int) and is thus a large positive number. INT_MIN has type signed int and is a negative number. The fact that they happen to have the same representation does not mean they are the same thing. -- Erik Trulsson ertr1013@student.uu.se