From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1758 invoked by alias); 28 Jun 2005 03:49:08 -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 1745 invoked by uid 22791); 28 Jun 2005 03:49:03 -0000 Received: from smtp-102-tuesday.noc.nerim.net (HELO mallaury.noc.nerim.net) (62.4.17.102) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 28 Jun 2005 03:49:03 +0000 Received: from uniton.integrable-solutions.net (gdr.net1.nerim.net [62.212.99.186]) by mallaury.noc.nerim.net (Postfix) with ESMTP id 5FE0262D06; Tue, 28 Jun 2005 05:48:57 +0200 (CEST) Received: from uniton.integrable-solutions.net (localhost [127.0.0.1]) by uniton.integrable-solutions.net (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id j5S3mPKY001550; Tue, 28 Jun 2005 05:48:25 +0200 Received: (from gdr@localhost) by uniton.integrable-solutions.net (8.12.10/8.12.10/Submit) id j5S3mPqM001549; Tue, 28 Jun 2005 05:48:25 +0200 To: Mark Mitchell Cc: Michael Veksler , Paul Koning , gcc@gcc.gnu.org, nathan@codesourcery.com Subject: Re: Do C++ signed types have modulo semantics? References: <42C0BE8C.4040308@codesourcery.com> From: Gabriel Dos Reis In-Reply-To: <42C0BE8C.4040308@codesourcery.com> Date: Tue, 28 Jun 2005 03:49:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-06/txt/msg01073.txt.bz2 Mark Mitchell writes: | Michael Veksler wrote: | | >> Most programmers "know" that arithmetic is modulo wordsize. And those few | >>who know the right answer (only unsigned arithmetic is modulo) will | >>from time to time slip up and omit the "unsigned" keyword in their | >>declarations. | | I agree. | | Although the standard clearly makes signed overflow undefined, I think | it would be better if GCC defined it to be modulo arithmetic. The | degree to which that would result in inferior code seems likely to be | somewhat small, and the amount of user confusion we would eliminate, | and the number of programs that would not break with GCC, even though | they work with other compilers, seems likely to be high. Amen. -- Gaby