From: Liu Hao <lh_mouse@126.com>
To: 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 10:46:36 +0800 [thread overview]
Message-ID: <e30fd375-8deb-94a3-92ad-6f1c7ef92283@126.com> (raw)
In-Reply-To: <e6c5789f-8e1f-732d-76a0-8444e4e8f96b@acm.org>
[-- Attachment #1.1: Type: text/plain, Size: 764 bytes --]
在 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.
--
Best regards,
LH_Mouse
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-08-12 2:48 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 [this message]
2020-08-12 18:40 ` David Blaikie
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=e30fd375-8deb-94a3-92ad-6f1c7ef92283@126.com \
--to=lh_mouse@126.com \
--cc=gcc@gcc.gnu.org \
--cc=gdb@sourceware.org \
--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).