From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73731 invoked by alias); 5 Dec 2019 20:06:59 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 73701 invoked by uid 89); 5 Dec 2019 20:06:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=card X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Dec 2019 20:06:57 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id xB5K6phS004821; Thu, 5 Dec 2019 14:06:51 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id xB5K6o3L004814; Thu, 5 Dec 2019 14:06:50 -0600 Date: Thu, 05 Dec 2019 20:06:00 -0000 From: Segher Boessenkool To: Jonathan Wakely Cc: Michael Matz , Thomas Schwinge , "gcc@gcc.gnu.org" , gcc-patches , "fortran@gcc.gnu.org List" Subject: Re: [RFC] Characters per line: from punch card (80) to line printer (132) (was: [Patch][OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) arguments) Message-ID: <20191205200650.GI3152@gate.crashing.org> References: <8be82276-81b1-817c-fcd2-51f24f5fe2d2@codesourcery.com> <20191205151515.GS10088@tucnak> <87lfrq6ahm.fsf@euler.schwinge.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00084.txt.bz2 Hi! On Thu, Dec 05, 2019 at 05:03:43PM +0000, Jonathan Wakely wrote: > C++17 introduces a nice feature, with rationale similar to declaring > variables in a for-loop init-statement: > > if (auto var = foo(); bar(var)) Similar to GNU C statement expressions, which are *also* only a good idea to use in limited cases. > The variable is only in scope for the block where you need it, just > like a for-loop. > > Unfortunately nearly every time I've tried to use this recently, I've > found it's impossible in 80 columns, e.g. this from yesterday: > > if (auto __c = __builtin_memcmp(&*__first1, &*__first2, __len) <=> > 0; __c != 0) > return __c; > > When you're forced to uglify every variable with a leading __ you run > out of characters pretty damn quickly. If using this "nice feature" forces you to uglify your code, then maybe it is not such a nice feature, and you should not use it. If you have issues with scoping your functions are WAY too long already. Segher