From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13388 invoked by alias); 26 Oct 2017 19:18:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13354 invoked by uid 89); 26 Oct 2017 19:18:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy= X-HELO: mail-wr0-f182.google.com Received: from mail-wr0-f182.google.com (HELO mail-wr0-f182.google.com) (209.85.128.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 26 Oct 2017 19:18:01 +0000 Received: by mail-wr0-f182.google.com with SMTP id y39so4195717wrd.4 for ; Thu, 26 Oct 2017 12:18:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=vcL0uy38vNiMLwH69MjrC09AwRWF8/6CnIgGPi08Q4Q=; b=lc67Fqho42+35pWl6EQCMRvuPIBI9knV4m6a2f5EfJEv5k+EleaBGgIG1w4vLscXse GidNFclaqGfUJaZ5bBsQp8gNclAEgddWfDJM4Ze66x5vbJuwsn+7o6fWguyyVAwxMvwq yjWw5hbhKxBX4fabvjHxFG6VeNv65O0cooODOalQe+Z4T0OzkK8Ai92HvJzCDXL9Ro9H WsFJR+KGv+6djrTGpWJsWlgrqKCoCpa3ZIUnEXGI1cLAzf9uizEzvIuf+XHV/leceNoO 8EeLFDeJiWlBgLJPIdFlzHII/gTrdz6GFMSCsvQLLx1hxfsxbWYRvXihnjfFkoK/haMa I3Uw== X-Gm-Message-State: AMCzsaVluuZkkc8zz7GkdQQIN2D8v5dGVUCtMzyYMcY9+81HHSOgkVPg 6KYeaTc+NvsANlh+D5MVEG7CrA== X-Google-Smtp-Source: ABhQp+TsEcB9DhAVyZx16f8tPt/Pvld8HqrGqAeolzbKNc5H2qGb1ZNhYT5TcuAjbDQWZbfnYGeqLg== X-Received: by 10.223.134.250 with SMTP id 55mr6511788wry.249.1509045478984; Thu, 26 Oct 2017 12:17:58 -0700 (PDT) Received: from [192.168.0.123] (bl17-148-124.dsl.telepac.pt. [188.82.148.124]) by smtp.gmail.com with ESMTPSA id x23sm742565wmc.31.2017.10.26.12.17.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 12:17:58 -0700 (PDT) Subject: Re: [006/nnn] poly_int: tree constants To: Martin Sebor , gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org References: <871sltvm7r.fsf@linaro.org> <878tg1u7cl.fsf@linaro.org> <877evi3oeh.fsf@linaro.org> <8737662tlp.fsf@linaro.org> <2840a6a6-f80c-ca8f-aab2-2729ac598bf6@gmail.com> <6a1236c2-f271-8309-5b7f-ac8723889cc0@redhat.com> <1c2abca8-d7e9-ab85-04c1-1618c8957368@gmail.com> From: Pedro Alves Message-ID: <50c0362c-d8d5-b75f-cd05-9017ed481b5c@redhat.com> Date: Thu, 26 Oct 2017 19:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1c2abca8-d7e9-ab85-04c1-1618c8957368@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-10/txt/msg01988.txt.bz2 On 10/26/2017 07:54 PM, Martin Sebor wrote: > (...) in the general case, it is preferable to > declare each variable at the point where its initial value is known > (or can be computed) and initialize it on its declaration. With that I fully agree, except it's not always possible or natural. The issue at hand usually turns up with conditional initialization, like: void foo () { int t; if (something) t = 1; else if (something_else) t = 2; if (t == 1) bar (); } That's a simple example of course, but more complicated conditionals aren't so easy to grok and spot the bug. In the case above, I'd much prefer if the compiler tells me I missed initializing 't' than initializing it to 0 "just in case". Thanks, Pedro Alves