public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: David Blaikie <dblaikie@gmail.com>
To: Liu Hao <lh_mouse@126.com>
Cc: Nathan Sidwell <nathan@acm.org>,
	Luis Machado <luis.machado@linaro.org>,
	 "gdb@sourceware.org" <gdb@sourceware.org>,
	gcc Mailing List <gcc@gcc.gnu.org>,
	Pedro Alves <palves@redhat.com>,  Simon Marchi <simark@simark.ca>
Subject: Re: Coding style for C++ constructs going forward
Date: Wed, 12 Aug 2020 11:40:05 -0700	[thread overview]
Message-ID: <CAENS6EtjVkm3Y1RbuzaFzp1YL_KajG8jUHJCrnv8VTRQ_V3Bag@mail.gmail.com> (raw)
In-Reply-To: <e30fd375-8deb-94a3-92ad-6f1c7ef92283@126.com>

On Tue, Aug 11, 2020 at 7:49 PM Liu Hao via Gdb <gdb@sourceware.org> wrote:
>
> 在 2020/8/11 下午9:55, Nathan Sidwell 写道:
> >
> > I agree, it's the way I use auto.  I particularly like the
> >    auto *foo = expr;
> > idiom, when you're getting a pointer, but the type of the pointee is clear.  It informs how you use 'foo'.
> >
> >
>
> Personally I dislike this syntax. Pointers are objects, and `auto foo = expr;` should suffice. What if the type of `expr` is
> `unique_ptr<T>` or `optional<T>`? The ptr-operator just can't exist there. So why the differentiation?
>
> `auto& foo = ...` and `const auto& foo = ...` are necessary to indicate that the entity being declared is a reference (and
> is not an object), while `auto*` doesn't make much sense, as I discourage plain pointers in my projects.

Then use of `auto*` would make it easier for you to spot use of plain
pointers in your projects & scrutinize them further?

>
>
>
> --
> Best regards,
> LH_Mouse
>

  reply	other threads:[~2020-08-12 18:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 14:06 Luis Machado
2020-08-07 14:56 ` Joel Brobecker
2020-08-07 15:48   ` Jakub Jelinek
2020-08-07 18:21 ` Jonathan Wakely
2020-08-07 19:09 ` Christian Biesinger
2020-08-11 13:55 ` Nathan Sidwell
2020-08-11 15:48   ` Jonathan Wakely
2020-08-12  2:46   ` Liu Hao
2020-08-12 18:40     ` David Blaikie [this message]
2020-08-13  6:44       ` Liu Hao
2020-08-13  8:03         ` Jonathan Wakely

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=CAENS6EtjVkm3Y1RbuzaFzp1YL_KajG8jUHJCrnv8VTRQ_V3Bag@mail.gmail.com \
    --to=dblaikie@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gdb@sourceware.org \
    --cc=lh_mouse@126.com \
    --cc=luis.machado@linaro.org \
    --cc=nathan@acm.org \
    --cc=palves@redhat.com \
    --cc=simark@simark.ca \
    /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).