From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115230 invoked by alias); 5 Dec 2019 22:34:03 -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 115195 invoked by uid 89); 5 Dec 2019 22:34:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=sane, card, our X-HELO: mail-wm1-f65.google.com Received: from mail-wm1-f65.google.com (HELO mail-wm1-f65.google.com) (209.85.128.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Dec 2019 22:34:00 +0000 Received: by mail-wm1-f65.google.com with SMTP id p17so5454720wmi.3; Thu, 05 Dec 2019 14:34:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9a+3bF9QR8zK8PQUVgBIR/F4LF2DkU5nzn/WG2/a8Bs=; b=jvk58L1hv/8NDGFFqnQuw0AD4izmdbd++fdFUR8kTlCbC0W/gkUdaKZz5TEJOh82yX MtCRmDYXDuKGDlmfLDmLgNGNICxbG2BivI3utjK17zNrcZeRJDHx5HCxHCMq9PLd3LWt 1NsYYw2AkQJOWlAsQLgWUerGK/CGOv2FZJvqTsoKdTPO8dPFfKGNih+Lfy6CeY/zSgSN YEl+VFYrVOPmHRVGWzTZZGhvHxkWJjqcabH5YsNQaDLPXoLC/l3yTy+9VQhDbwwjynca gQ77RVFXOcRtXiuFc4DAxWBs2Avepct5MOcCjKHarWusYpyyg4anSDm9CoKmFB1SJDh7 G+Hw== MIME-Version: 1.0 References: <8be82276-81b1-817c-fcd2-51f24f5fe2d2@codesourcery.com> <20191205151515.GS10088@tucnak> <87lfrq6ahm.fsf@euler.schwinge.homeip.net> <20191205200650.GI3152@gate.crashing.org> <20191205221939.GN3152@gate.crashing.org> In-Reply-To: <20191205221939.GN3152@gate.crashing.org> From: Jonathan Wakely Date: Thu, 05 Dec 2019 22:34:00 -0000 Message-ID: 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) To: Segher Boessenkool Cc: Michael Matz , Thomas Schwinge , "gcc@gcc.gnu.org" , gcc-patches , "fortran@gcc.gnu.org List" Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-12/txt/msg00097.txt.bz2 On Thu, 5 Dec 2019 at 22:19, Segher Boessenkool wrote: > > On Thu, Dec 05, 2019 at 08:56:35PM +0000, Jonathan Wakely wrote: > > On Thu, 5 Dec 2019 at 20:07, Segher Boessenkool > > wrote: > > > 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: > > > > > 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. > > > > The uglification has absolutely nothing to do with the 'if' > > init-statement feature, all code in libstdc++ headers has to be > > uglified, always. Blame the C preprocessor for that, not C++ features. > > > > My point is that 80 characters runs out quicker when 10% of it goes on > > visual noise that's only needed because the C preprocessor means we > > can't have nice names. > > (Not sure where the preprocessor comes in, these underscores are just to > satisfy language rules afaics, but maybe you mean something else?) The language rules are only necessary because of the preprocessor. Users can define macros with names like "pred" and "cmp" before including any standard library header, and because macros don't respect lexical scope, that would break any standard library code using "pred" and "cmp". So the std::lib has to use reserved names. It's entirely due to the preprocessor that we can't use sane names for local variables, or for any implementation detail in a header (unlike in C, our helper types and functions are in a namespace so won't collide with users' types and functions, but we still have to use reserved names because the preprocessor doesn't respect namespaces).