Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8326716

JVMTI spec: clarify what nullptr means for C/C++ developers

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • None
    • hotspot
    • None
    • b26

      The following RFE was fixed recently:
      8324680: Replace NULL with nullptr in JVMTI generated code

      Alan and David posted comments after this RFE was integrated.

      Alan's comment:
      JVMTI agents can be developed in C or C++. If I read this changes correctly, then this will replace all the NULLs in the generated spec with nullptr. I wonder if this needs some setup in the Introduction section, e.g. the Function Return Values subsection, to make this clear.

      David's comment:
      As with the other NULL -> nullptr changes, when it involves text (as opposed to code) and we are discussing the general concept of nullness, then the word "null" should be used rather than the programmatic values NULL or nullptr. But if the source here is used to generated both the spec's functional descriptions and the code functions themselves, then we cannot make that distinction. I'm not sure this change was actually a good idea. At a minimum we need something like @AlanBateman suggests, something upfront to say that where the spec says nullptr it also means a C null pointer.

      Current section looks as below:

      Function Return Values

      JVM TI functions always return an error code via the jvmtiError function return value. Some functions can return additional values through pointers provided by the calling function. In some cases, JVM TI functions allocate memory that your program must explicitly deallocate. This is indicated in the individual JVM TI function descriptions. Empty lists, arrays, sequences, etc are returned as nullptr.
      In the event that the JVM TI function encounters an error (any return value other than JVMTI_ERROR_NONE) the values of memory referenced by argument pointers is undefined, but no memory will have been allocated and no global references will have been allocated. If the error occurs because of invalid input, no action will have occurred.

      The nullptr is mentioned here. So, we want to clarify what `nullptr` mean for C/C++ code.

            sspitsyn Serguei Spitsyn
            sspitsyn Serguei Spitsyn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: