From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1179 invoked by alias); 29 Jun 2005 13:35:07 -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 1107 invoked by uid 22791); 29 Jun 2005 13:35:00 -0000 Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 29 Jun 2005 13:35:00 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id C083F962C; Wed, 29 Jun 2005 09:34:58 -0400 (EDT) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10027-02-5; Wed, 29 Jun 2005 09:34:58 -0400 (EDT) Received: from [127.0.0.1] (taconic.gnat.com [205.232.38.103]) by nile.gnat.com (Postfix) with ESMTP id 906DE962A; Wed, 29 Jun 2005 09:34:58 -0400 (EDT) Message-ID: <42C2A381.6070800@adacore.com> Date: Wed, 29 Jun 2005 13:35:00 -0000 From: Robert Dewar User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913) MIME-Version: 1.0 To: Dave Korn CC: Theodore.Papadopoulo@sophia.inria.fr, 'Michael Veksler' , gcc@gcc.gnu.org Subject: Re: The utility of standard's semantics for overflow References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-06/txt/msg01255.txt.bz2 Dave Korn wrote: > In fact, doesn't this suggest that in _most_ circumstances, *saturation* > would be the best behaviour? Actually I think a handlable exception, a la Ada, is the best solution. Whether saturation is appropriate is really problem dependent. If you are counting the number of primes less than bla, then saturating is not likely to be helpful. If you are computing some real quantity with minimal precision, saturation might be helpful > > And of course, since it's undefined, a compiler could entirely > legitimately use saturating instructions (on a platform that supports them) > for signed int arithmetic. yes, of course, this would indeed be legitimate, and could be an option. Almost anything is reasonable as an option. I think it would be quite reasonable to have options for trapping (-ftrapv working nicely :-) and for wrap around. But I would not normally make either of these the default in C. > > cheers, > DaveK