From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16857 invoked by alias); 28 Jun 2005 16:59:16 -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 16817 invoked by uid 22791); 28 Jun 2005 16:59:11 -0000 Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.195) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 28 Jun 2005 16:59:11 +0000 Received: by rproxy.gmail.com with SMTP id f1so1863767rne for ; Tue, 28 Jun 2005 09:59:10 -0700 (PDT) Received: by 10.38.86.8 with SMTP id j8mr1687808rnb; Tue, 28 Jun 2005 09:59:10 -0700 (PDT) Received: by 10.38.76.22 with HTTP; Tue, 28 Jun 2005 09:59:10 -0700 (PDT) Message-ID: <118833cc050628095953822bab@mail.gmail.com> Date: Tue, 28 Jun 2005 16:59:00 -0000 From: Morten Welinder Reply-To: Morten Welinder To: galibert@pobox.com Subject: Re: signed is undefined and has been since 1992 (in GCC) Cc: gcc@gcc.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-SW-Source: 2005-06/txt/msg01144.txt.bz2 > In particular, a very large number of C and C++ programs are written > with the assumptions: >- signed and unsigned types are modulo, except in loop induction > variables where it's bad taste Well, as demonstrated by INT_MIN/-1, gcc has NEVER fulfilled such assumptio= ns on i86 and, quite likely, neither has or will any other compiler. The run= time penalty would be too big and hurt performance numbers. What I believe you can find examples of is that the more restricted claim of "addition and perhaps subtraction of signed numbers is modulo" is being assumed. That's cheap since (for 2-complement) signed addition is the same operation as unsigned addition. Morten