[RFC] Throwing an exception with null pointers

Derek Fawcus dfawcus+dlang at employees.org
Wed Apr 16 22:54:53 UTC 2025


On Wednesday, 16 April 2025 at 22:43:24 UTC, Derek Fawcus wrote:
> ```
> $ clang-14 -Wall -Wnullable-to-nonnull-conversion -c ttt.c
> ttt.c:37:8: warning: implicit conversion from nullable pointer 
> 'int * _Nullable' to non-nullable pointer type 'int * _Nonnull' 
> [-Wnullable-to-nonnull-conversion]
>         ptr = arg3;
>               ^
> ttt.c:41:20: warning: implicit conversion from nullable pointer 
> 'int * _Nullable' to non-nullable pointer type 'int * _Nonnull' 
> [-Wnullable-to-nonnull-conversion]
>         a += *someNonNull(arg3);
>                           ^
> ttt.c:29:16: warning: variable 'ptr' set but not used 
> [-Wunused-but-set-variable]
>         int * NONNULL ptr;
>                       ^
> 3 warnings generated.
> ```

Having now got this to complain in the desired fashion, I'll now 
be applying it to some code at work.  More help in quashing 
sources of bugs.


More information about the Digitalmars-d mailing list