bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnulib and nullptr


From: Paul Eggert
Subject: Re: Gnulib and nullptr
Date: Mon, 6 Feb 2023 18:30:26 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 2/6/23 15:16, Bruno Haible wrote:

Ignoring or underestimating the "barrier to entry" issue
was my biggest mistake in GNU clisp development so far.

Fair enough, but surely there are differences between the clisp and Gnulib cases. In C++ there are more advantages to nullptr (so more of a pressure to use it) than in C. As C++ is popular, many potential contributors will be used to nullptr being better; for these people, using NULL will be a barrier to entry.

Thus, it is better to have a rule (at least per project). Any of the
two rules
   - "Avoid NULL, write nullptr always."
   - "In varargs calls, write nullptr instead of  (foo *) NULL."
is better than a random mix of NULL and nullptr in the same project.

In diffutils proper I switched to the former rule (though code imported from Gnulib still uses NULL so people that build from tarballs will still see a mixture). I plan to try things out this way for a while, to see whether there are problems with the Gnulib nullptr implementation. We can convert more intensely-maintained projects later, depending on diffutils goes.

A couple of other things.

1. Since the nullptr issue affects C++ so much (something I wasn't aware of until now), I'm inclined to rename the module from c-nullptr to nullptr as was hinted earlier. It's not just C so the "c-" is a bit misleading.

2. The issues you mentioned about C++ compilers possibly not supporting nullptr seem to be serious enough that it seems that we should test the C++ compiler at configure time, as we already test the C compiler. That way we wouldn't have to worry whether our __cplusplus-related #ifdefs are OK.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]