Hi,

This is just an untested draft.  If there's rough agreement that this is
wanted, I'll test it, write changelog, etc.

The intention of this change is to help improve the common C/C++
language subset, promoting the use of NULL in both languages as the null
pointer constant, expanding to nullptr in C++, and to ((void *)0) in C.

While C23 added nullptr, it was a terrible mistake, and it doesn't do
any good to the C language.  (See the link below for more details.)
Instead, it's C++ which should reconcile with C.  Let's work in that
direction.

Link: <https://software.codidact.com/posts/292718>

Have a lovely day!
Alex

Alejandro Colomar (5):
  gcc/ginclude/stddef.h: Indent nested cpp conditionals
  gcc/ginclude/stddef.h: Invert conditional
  gcc/ginclude/stddef.h: Define NULL as nullptr if possible
  Don't define NULL as 0 in C
  libgm2/libm2pim/wrapc.cc: Define NULL as nullptr

 gcc/ginclude/stddef.h                         | 24 +++++++++++--------
 .../gcc.c-torture/execute/pr68143_1.c         |  2 +-
 gcc/testsuite/gcc.c-torture/execute/pr70566.c |  2 +-
 gcc/testsuite/gcc.dg/tm/20100615.c            |  2 +-
 gcc/testsuite/gcc.target/aarch64/pr91927.c    |  2 +-
 libgm2/libm2pim/wrapc.cc                      |  4 +---
 libiberty/alloca.c                            |  2 +-
 libiberty/argv.c                              |  2 +-
 libiberty/getopt1.c                           |  2 +-
 9 files changed, 22 insertions(+), 20 deletions(-)

Range-diff:
-:  ----------- > 1:  8db5b662bdf gcc/ginclude/stddef.h: Indent nested cpp 
conditionals
-:  ----------- > 2:  74c07a6be6e gcc/ginclude/stddef.h: Invert conditional
-:  ----------- > 3:  f0e9337f2e3 gcc/ginclude/stddef.h: Define NULL as nullptr 
if possible
-:  ----------- > 4:  30dc1a7973f Don't define NULL as 0 in C
-:  ----------- > 5:  e1836aac591 libgm2/libm2pim/wrapc.cc: Define NULL as 
nullptr
-- 
2.45.2

Attachment: signature.asc
Description: PGP signature

Reply via email to