From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5539 invoked by alias); 23 Sep 2013 22:44:42 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 5527 invoked by uid 89); 23 Sep 2013 22:44:41 -0000 Received: from asbnvacz-mailrelay01.megapath.net (HELO asbnvacz-mailrelay01.megapath.net) (207.145.128.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Sep 2013 22:44:41 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-HELO: asbnvacz-mailrelay01.megapath.net Received: from mail5.sea5.speakeasy.net (mail5.sea5.speakeasy.net [69.17.117.49]) by asbnvacz-mailrelay01.megapath.net (Postfix) with ESMTP id 934F61EE6077 for ; Mon, 23 Sep 2013 18:43:17 -0400 (EDT) Received: (qmail 14190 invoked from network); 23 Sep 2013 22:43:17 -0000 Received: by simscan 1.4.0 ppid: 13433, pid: 26812, t: 0.5372s scanners: clamav: 0.88.2/m:52/d:10739 Received: from unknown (HELO oak.schemamania.org) ([216.254.83.208]) (envelope-sender ) by mail5.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 23 Sep 2013 22:43:16 -0000 Received: from oak.schemamania.org (localhost [IPv6:::1]) by oak.schemamania.org (Postfix) with SMTP id 2200930E118B for ; Mon, 23 Sep 2013 18:43:15 -0400 (EDT) Date: Mon, 23 Sep 2013 22:44:00 -0000 From: "James K. Lowden" To: gcc-help@gcc.gnu.org Subject: Re: how to make gcc warn about arithmetic signed overflow Message-Id: <20130923184314.ada65e1d.jklowden@schemamania.org> In-Reply-To: References: <20130921164609.GC3086@a.lan> <20130921174229.GD3086@a.lan> <20130923000355.fa2a964c.jklowden@schemamania.org> <20130923114717.1033f2b8.jklowden@schemamania.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00165.txt.bz2 On Mon, 23 Sep 2013 22:50:09 +0100 Jonathan Wakely wrote: > On 23 September 2013 16:47, James K. Lowden wrote: > > > > 7.1.6 is itself mutable, it turns out. My yellowed ARM, copyright > > 1990, is considerably more relaxed on the question. (And > > considerably easier to read. I don't know how anyone learns C++ > > these days, so dense is the technical terminology.) > > The standard isn't meant to be a tutorial and noone should try to > learn C++ from the standard. Stroustrup's 4th edition of The C++ > Programming Language is much easier to read (but not all that much > shorter) than the standard. Granted, but no one ever confused the ARM with a tutorial. It *was* the standard, 23 years ago. It defined the language, with commentary, in under 500 pages, and gave the compiler precious few UB opportunities. An experienced programmer could read it, learn the language and rely on what he'd read. I understand the language has grown somewhat, but the equivalent book would be 3000 pages today. (The standard alone is 1300.) A good deal of it is devoted to Get Out of Jail Free cards for the compiler: describing what might compile and not produce a deterministic result. As with all the tut-tutting about type-punning, for example. When did this become a good idea? The compiler's job is to convert C ++ logic into machine logic, and to reject anything it cannot do so with absolute assurance. If I could wish something for C++14, it would be a 90% reduction in UB descriptions. Let's define the behavior and be done with it. By removing ambiguity, maybe the definition the language would become readable again. --jkl