JDK-8324686 : Remove redefinition of NULL for MSVC
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86
  • Submitted: 2024-01-25
  • Updated: 2025-04-24
  • Resolved: 2025-04-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b19Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
In globalDefinitions_visCPP.hpp there is a redefinition of NULL to work around an issue with it being a 32bit int (so not pointer sized) on 64bit platforms.  Once all uses of NULL in HotSpot have been replaced with nullptr, there is no longer any need for this, and it can be removed.

One might think that redefinition might no longer be needed at all, since it's working around a pretty old issue. But apparently it's still the case that sizeof(NULL) != sizeof(void*) for 64bit builds. But a literal 0 (a 32bit int) is a valid null pointer constant.

Comments
Changeset: 6c266701 Branch: master Author: Kim Barrett <kbarrett@openjdk.org> Date: 2025-04-10 10:21:32 +0000 URL: https://git.openjdk.org/jdk/commit/6c2667018a49ac78c3a01dc4d52ff6cdf39b7647
10-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24537 Date: 2025-04-09 06:16:18 +0000
09-04-2025