public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Jonathan Wakely <jwakely.gcc@gmail.com>,
	Michael Matz <matz@suse.de>,
	Thomas Schwinge <thomas@codesourcery.com>,
	"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	"fortran@gcc.gnu.org List" <fortran@gcc.gnu.org>
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)
Date: Thu, 05 Dec 2019 20:38:00 -0000	[thread overview]
Message-ID: <20191205203815.GO119925@redhat.com> (raw)
In-Reply-To: <20191205200650.GI3152@gate.crashing.org>

On Thu, Dec 05, 2019 at 02:06:50PM -0600, Segher Boessenkool wrote:
> 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.

I disagree, it is a nice feature, without quotes.  It's Good Style not to
leak variables into enclosing scopes.

> If you have issues with scoping your functions are WAY too long already.

I don't think that's the case here.

--
Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA

  reply	other threads:[~2019-12-05 20:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8be82276-81b1-817c-fcd2-51f24f5fe2d2@codesourcery.com>
     [not found] ` <20191205151515.GS10088@tucnak>
2019-12-05 15:47   ` Thomas Schwinge
2019-12-05 16:04     ` Jakub Jelinek
2019-12-05 20:21       ` Segher Boessenkool
2019-12-05 16:17     ` Joseph Myers
2019-12-05 16:24       ` Paul Koning
2019-12-05 16:40         ` Jeff Law
2019-12-05 16:55         ` [RFC] Characters per line: from punch card (80) to line printer (132) Florian Weimer
2019-12-05 17:55       ` Andrew Stubbs
2019-12-05 18:12         ` Eric Gallager
2019-12-05 18:22         ` Robin Curtis
2019-12-05 19:16           ` James Secan
2019-12-06  9:22           ` Andrew Stubbs
2019-12-05 16:44     ` [RFC] Characters per line: from punch card (80) to line printer (132) (was: [Patch][OpenMP/OpenACC/Fortran] Fix mapping of optional (present|absent) arguments) Michael Matz
2019-12-05 17:03       ` Jonathan Wakely
2019-12-05 18:07         ` Marek Polacek
2019-12-05 20:06         ` Segher Boessenkool
2019-12-05 20:38           ` Marek Polacek [this message]
2019-12-05 22:02             ` Segher Boessenkool
2019-12-05 20:56           ` Jonathan Wakely
2019-12-05 22:19             ` Segher Boessenkool
2019-12-05 22:34               ` Jonathan Wakely
2019-12-05 22:37               ` Jonathan Wakely
2019-12-05 23:02                 ` Segher Boessenkool
2019-12-05 17:29       ` N.M. Maclaren
2019-12-05 20:12       ` Segher Boessenkool
2019-12-05 20:41       ` Jason Merrill
2019-12-05 18:54     ` [RFC] Characters per line: from punch card (80) to line printer (132) Martin Sebor
2019-12-05 20:32       ` Segher Boessenkool

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191205203815.GO119925@redhat.com \
    --to=polacek@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    --cc=matz@suse.de \
    --cc=segher@kernel.crashing.org \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).