Home  >  Q&A  >  body text

How to understand `#define` with parameters?

part1

  VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
             GENERATE_STATIC_VM_STRUCT_ENTRY,
             GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
             GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
             GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
             GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
             GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
             GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
             GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)

part2

//--------------------------------------------------------------------------------
// VM_STRUCTS
//
// This list enumerates all of the fields the serviceability agent
// needs to know about. Be sure to see also the type table below this one.
// NOTE that there are platform-specific additions to this table in
// vmStructs_<os>_<cpu>.hpp.

#define VM_STRUCTS(nonstatic_field, \
                   static_field, \
                   unchecked_nonstatic_field, \
                   volatile_nonstatic_field, \
                   nonproduct_nonstatic_field, \
                   c1_nonstatic_field, \
                   c2_nonstatic_field, \
                   unchecked_c1_static_field, \
                   unchecked_c2_static_field) \

is usually

#define type alias

But here we see

#define type ___

I underline it to mean nothing.

If you really just "bring people" to replace it, then there will be nothing above it. Even if you substitute all the parameters,
but #define type ___ is Nothing.

How do you understand the above syntax?

Source code comes from jdk8.

阿神阿神2666 days ago757

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-06-05 11:12:42

    Help you find the complete source code http://hg.openjdk.java.net/jd...

    From line 50 to line 794, all these codes are one line.

    The following is not nothing, but more than 700 lines of code.

    reply
    0
  • Cancelreply