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 14:06:50 -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>
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