Maison  >  Questions et réponses  >  le corps du texte

c++ - Comment comprendre `#define` avec des paramètres ?

partie1

  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)

partie2

//--------------------------------------------------------------------------------
// 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) \

Habituellement

#define type alias

Mais ici, nous voyons

#define type ___

J'ai souligné pour ne rien dire.

Si vous « amenez des gens » pour le remplacer, alors il n'y aura rien dessus Même si vous remplacez tous les paramètres,
mais #define type ___ ce ne sera rien.

Comment comprenez-vous la grammaire ci-dessus ?

Le code source provient de jdk8.

阿神阿神2666 Il y a quelques jours756

répondre à tous(1)je répondrai

  • 伊谢尔伦

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

    Vous aider à trouver le code source complet http://hg.openjdk.java.net/jd...

    De la ligne 50 à la ligne 794, tous ces codes ne forment qu'une seule ligne.

    Ce qui suit n'est pas rien, mais plus de 700 lignes de code.

    répondre
    0
  • Annulerrépondre