From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4558 invoked by alias); 23 Sep 2004 11:38:09 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 4549 invoked from network); 23 Sep 2004 11:38:09 -0000 Received: from unknown (HELO NUTMEG.CAM.ARTIMI.COM) (217.40.111.177) by sourceware.org with SMTP; 23 Sep 2004 11:38:09 -0000 Received: from mace ([192.168.1.25]) by NUTMEG.CAM.ARTIMI.COM with Microsoft SMTPSVC(6.0.3790.0); Thu, 23 Sep 2004 12:38:06 +0100 From: "Dave Korn" To: "'Andreas Schwab'" Cc: "'Morten Welinder'" , Subject: RE: signed vs unsigned pointer warning Date: Thu, 23 Sep 2004 12:29:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit In-Reply-To: Message-ID: X-OriginalArrivalTime: 23 Sep 2004 11:38:06.0798 (UTC) FILETIME=[CB4DA6E0:01C4A161] X-SW-Source: 2004-09/txt/msg01336.txt.bz2 > -----Original Message----- > From: Andreas Schwab > Sent: 22 September 2004 22:57 > To: Dave Korn > Cc: 'Morten Welinder'; gcc > Subject: Re: signed vs unsigned pointer warning > > "Dave Korn" writes: > > > Which I don't think you can, since you can't store negative numbers > > in an unsigned type. > > Actually you can, due to the modulo behaviour of unsigned integers. > > Andreas. Well, yes, it is physically possible, but it's a kind of type-punning, it defies the aliasing rules, and we get into some very deeply language-lawyerly issues here, but it's not a valid representation IIUIC and therefore invokes undefined behaviour in many circumstances. cheers, DaveK -- Can't think of a witty .sigline today....