_Optional: a type qualifier to indicate pointer nullability

Jonathan Wakely jwakely.gcc@gmail.com
Sat Feb 4 23:52:56 GMT 2023


On Sat, 4 Feb 2023, 21:23 Christopher Bazley, <cs99cjb@gmail.com> wrote:

>
>
> 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.
>

But marking pointer arguments as non-null is already supported in GCC (with
an attribute on the function, not the argument). Supporting a nonnull
attribute on individual arguments seems useful to me. Far more than marking
pointers as maybe-null, which is already true for all pointers.


More information about the Gcc mailing list