RFR: 8327173: HotSpot Style Guide needs update regarding nullptr vs NULL

Aleksey Shipilev shade at openjdk.org
Mon Mar 4 09:54:53 UTC 2024


On Mon, 4 Mar 2024 08:41:46 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Please review this change to update the HotSpot Style Guide's discussion of
>> nullptr and its use.
>> 
>> I suggest this is an editorial rather than substantive change to the style
>> guide.  As such, the normal HotSpot PR process can be used for this change.
>
> doc/hotspot-style.md line 730:
> 
>> 728: Use `nullptr`
>> 729: ([n2431](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf))
>> 730: rather than `NULL`.  Don't use (constant expression or literal) 0 for pointers.
> 
> Should there be any discussion here of why we want to avoid `NULL`?  Specifically the varying
> definitions and the pitfalls of `NULL` in varargs context.  Also template and overload issues.

I think it would be enough to write 1..2 sentences about this, and then defer to N2431 already linked here for more details.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18101#discussion_r1510890143


More information about the build-dev mailing list