From: David Malcolm <dmalcolm@redhat.com>
To: paulmck@kernel.org, linux-toolchains@vger.kernel.org
Subject: Re: Do we care if C compilers start allowing "." on pointers?
Date: Sat, 11 Jan 2025 12:12:45 -0500 [thread overview]
Message-ID: <678b06548be13a75ce3ebfb8a3a019ca60285f95.camel@redhat.com> (raw)
In-Reply-To: <6c55adc5-52f9-45e2-aa20-ef344c9dd1ea@paulmck-laptop>
On Fri, 2025-01-10 at 07:02 -0800, Paul E. McKenney 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?
Is the proposal likely to actually happen to either C++ or C?
I hope the proposal can be ignored; FWIW (with as a GCC diagnostics
maintainer) the proposal seems a bad idea to me: the proposal (in "C++
Compiler modification notes") seems to be suggesting this is a
relatively simple change to the compiler - but it seems to not account
for:
- the cost of teaching language users about the change
- the cost of bifurcating the languages into before/after the change
- providing useful compiler diagnostics if someone tries to compile
code using this with an older version of the language
- support for this in IDEs (e.g. code-completion)
- dealing with smart pointers and operator overloading in C++
- in C++ this may open up a huge can of worms relating to template
substitutions, since it (perhaps; not sure) might allow previously-
failing substitutions to succeed, thus breaking existing codebases
...etc
I don't buy the supposed motivations at all, e.g. "Simplifies the
knowledge required to start programming in C" ...by adding a new
fundamental way to do things, decades in; surely this just complicates
things?
C has its warts, but
These are just my personal opinions, of course.
Hope this is constructive
Dave
>
> Thanx, Paul
>
> [1]
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2142r1.pdf
>
next prev parent reply other threads:[~2025-01-11 17:12 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
2025-01-13 22:01 ` Bill Wendling
2025-01-11 17:12 ` David Malcolm [this message]
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=678b06548be13a75ce3ebfb8a3a019ca60285f95.camel@redhat.com \
--to=dmalcolm@redhat.com \
--cc=linux-toolchains@vger.kernel.org \
--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