From: Florian Weimer <fweimer@redhat.com>
To: Bill Wendling <morbo@google.com>
Cc: paulmck@kernel.org, linux-toolchains@vger.kernel.org
Subject: Re: Do we care if C compilers start allowing "." on pointers?
Date: Sun, 12 Jan 2025 20:57:29 +0100 [thread overview]
Message-ID: <87frln6c0m.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAGG=3QWKVpoZAh_yD=15pkbRUVSeAmt5DJ94hKfxJ5HfTqV=Rg@mail.gmail.com> (Bill Wendling's message of "Fri, 10 Jan 2025 17:09:21 -0800")
* Bill Wendling:
> On Fri, Jan 10, 2025 at 7:02 AM Paul E. McKenney <paulmck@kernel.org> wrote:
>>
>> Hello!
>>
>> Currently, given a pointer "p", C allows p->a but not p.a. There is a
>> proposal from C++ [1] that is being considered for C.
>>
>> Do we care?
>>
> Does the proposal seem likely to be added to C++? The motivation is
> very weak, in my opinion. Other languages are very different from
> C/C++; they try to hide away memory management details, which are a
> major part of C languages. (To prevent a holy war, my comments aren't
> about the benefits and drawbacks of memory management in other
> languages.)
User-defined pointer-like types obviously have to use -> for the
deference operation because . is reserved for operations on the pointer
object itself. So certain templated code would have to remember to use
-> anyway. So it's surprising this proposed in the C++ context.
For C as of today, this wouldn't matter. However, if we ever get
bounds-carrying pointers, writing p.length or p.limit to access such
information with the pointer p would make sense.
Thanks,
Florian
next prev parent reply other threads:[~2025-01-12 19:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 15:02 Do we care if C compilers start allowing "." on pointers? Paul E. McKenney
2025-01-11 1:09 ` Bill Wendling
2025-01-11 5:25 ` Paul E. McKenney
2025-01-11 7:55 ` Segher Boessenkool
2025-01-12 19:57 ` Florian Weimer [this message]
2025-01-13 22:01 ` Bill Wendling
2025-01-11 17:12 ` David Malcolm
2025-01-12 17:37 ` Paul E. McKenney
2025-01-13 23:50 ` Jason Merrill
2025-01-14 18:47 ` Paul E. McKenney
2025-01-13 11:16 ` Peter Zijlstra
2025-01-14 18:48 ` Paul E. McKenney
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=87frln6c0m.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=linux-toolchains@vger.kernel.org \
--cc=morbo@google.com \
--cc=paulmck@kernel.org \
/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