Hi Paul, On Thu, Nov 14, 2024 at 07:51:24PM GMT, Bruno Haible wrote: > Paul Eggert wrote: > > > Maybe we should override NULL on this platform (where it is defined as 0)? > > > > I wouldn't mess with NULL, as too much oddball stuff depends on it. > > I would mess with it only when a configure test detects that it expands to a > non-pointer. That is, when a conditional expression > (foo ? "x" : NULL) > sollicits a compilation error. This catches exactly the AIX case. > > > Why not use nullptr instead? It's the modern replacement. > > In the other thread, that started yesterday, Alejandro pointed to the > history of 'nullptr' in C [1]. Also, my evaluation from last year [2] > still stands: The general habit in the community is to use NULL. I have > only seen 1 C package that consistently uses nullptr.
As Bruno said, nullptr is garbage that was force-fed by C++ people into WG14 with no rationale at all. It won't be used in any projects that I maintain, as long as I continue maintaining them. Please see the link [1] below, which explains the history which serves as a rationale for this negative to use it. Eventually, I plan to send a proposal to WG14 to remove nullptr{,_t} from ISO C. This will be slow, and requires some (also slow) pre-requisite steps, which include (1) deprecating 0, (2) removing 0, and (3) making ISO C force the POSIX definition which is void*. This means two decades or more, but I hope I can do it eventually. I'm now the National Body of Spain in WG14, and I'll do as much pressure as I possibly can. :-) Have a lovely day! Alex > Bruno > > [1] https://software.codidact.com/posts/292718/292759#answer-292759 > [2] https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00031.html -- <https://www.alejandro-colomar.es/>
signature.asc
Description: PGP signature