public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christopher Bazley <cs99cjb@gmail.com>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: _Optional: a type qualifier to indicate pointer nullability
Date: Sat, 4 Feb 2023 21:22:57 +0000	[thread overview]
Message-ID: <CAKBShRQCLfEaODY16k9MfbnyrCug9uO56SAHzT0=CzPdw_v2iw@mail.gmail.com> (raw)
In-Reply-To: <CAH6eHdSKpWY=QMreFVBxX36+uuby6Y8-LqaVZqNqTOLRwHkTLw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2261 bytes --]

On Sat, 4 Feb 2023 at 20:40, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:

>
> On Sat, 4 Feb 2023, 17:01 Christopher Bazley via Gcc, <gcc@gcc.gnu.org>
> wrote:
>
>>
>> Does the lack of support for Clang's nullability qualifiers in GCC
>> indicate
>> a greater likelihood for my proposed feature to be accepted into GCC?
>
>
> No, I don't think so. I think it would be better to support the same
> qualifiers as Clang, not diverge in this way.
>

Clang’s _Nullable qualifier is broken and pretty useless (even according to
the code owner), so good luck with that.

In fact I agree with most of his comment at
>
> https://discourse.llvm.org/t/rfc-optional-a-type-qualifier-to-indicate-pointer-nullability/68004/16
>
> I particularly agree that no new language extension is needed to express a
> pointer that can be null, that's just how pointers have always worked. A
> pointer that cannot be null is more deserving of special attributes or
> qualifiers to say that it has additional guarantees that aren't implied by
> just being a pointer.
>

It’s not a matter what which kind of pointer is “deserving”. One choice is
pleasant and expressive, whereas the other (C with _Nonnull attributes) is
neither type-safe nor ergonomic.

Meanwhile, on Reddit, my proposal has an 85% upvote rate, and on LinkedIn,
“Great idea and I hope it gets itself in to a future standard, but I
couldn't wait for something like that to arrive in C…”

I wonder how many other people “couldn’t wait”. I guess they already left
the debate.

If my proposal has little value to you (quite likely, if you are a C++
>> programmer), please bear in mind that it is just a simple tool (like
>> 'const') that individuals can choose to use, or not. It entails only a
>> minor change to the semantics of one operator. Yes, it is contagious, but
>> nobody will be forced to use _Optional in their project, and it is easy to
>> hide using a macro. I don't feel that it deserves to be killed at birth.
>>
>
> Language extensions don't deserve to be added to a compiler just because
> somebody put a lot of work into them.
>

I never said that they did. You’ve conflated two unrelated paragraphs.

-- 
Christopher Bazley

  reply	other threads:[~2023-02-04 21:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 17:00 Christopher Bazley
2023-02-04 20:39 ` Jonathan Wakely
2023-02-04 21:22   ` Christopher Bazley [this message]
2023-02-04 23:52     ` Jonathan Wakely
2023-02-05  8:07       ` Christopher Bazley
2023-02-05 10:20         ` 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='CAKBShRQCLfEaODY16k9MfbnyrCug9uO56SAHzT0=CzPdw_v2iw@mail.gmail.com' \
    --to=cs99cjb@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.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).