This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
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)
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Michael Matz <matz at suse dot de>, Thomas Schwinge <thomas at codesourcery dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>
- Date: Thu, 5 Dec 2019 16:19:39 -0600
- 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)
- References: <8be82276-81b1-817c-fcd2-51f24f5fe2d2@codesourcery.com> <20191205151515.GS10088@tucnak> <87lfrq6ahm.fsf@euler.schwinge.homeip.net> <alpine.LSU.2.21.1912051634470.24095@wotan.suse.de> <CAH6eHdRxXmjv5w7QzQwwqez4f46rAL417v9tfoyyAauVBP1eFg@mail.gmail.com> <20191205200650.GI3152@gate.crashing.org> <CAH6eHdQyNM_Mp=ACyWSkgkpbZ55CrJ9dKNJZqsLAARpJTugKZg@mail.gmail.com>
On Thu, Dec 05, 2019 at 08:56:35PM +0000, Jonathan Wakely wrote:
> On Thu, 5 Dec 2019 at 20:07, Segher Boessenkool
> <segher@kernel.crashing.org> 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?)
Or you could write
auto __c = (__builtin_memcmp(&*__first1, &*__first2, __len) <=> 0);
if (__c)
return __c;
which is much easier to read, to my eyes anyway. And it is exactly the
same for the compiler.
Wrapping everything inside-out just for the artificial goal of having
things defined in slightly tighter scopes feels futile.
Segher