简体   繁体   中英

how to understand this define macro?

I am learning Dalvik VM code but stopped by some strange C define macros in file InterpC-portable.cpp . They're hard to understand for me. The code is:

# define H(_op)             &&op_##_op

and in file libdex/DexOpcodes.h , it is used like this:

#define DEFINE_GOTO_TABLE(_name) \
  static const void* _name[kNumPackedOpcodes] = {                      \
  /* BEGIN(libdex-goto-table); GENERATED AUTOMATICALLY BY opcode-gen */ \
  H(OP_NOP),                                                            \
  H(OP_MOVE),                                                           \
  H(OP_MOVE_FROM16),                                                    \
  ...

OP_NOP, OP_MOVE, OP_MOVE_FROM16 are some enum variable. But what's the meaning of && operation in H(_op) macro? It doesn't make sense to get a pointer of pointer which doesn't store at memory. Anyone can help me? Thanks.

&& is the label value operator . It returns he addres of a label defined in the current scope, used as operand. It is a gcc extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM