为什么数组变量名称有魔力?这个是来做什么的?

时间:2018-01-25 11:41:06

标签: perl perl-xs

PAD_COMPNAME获取变量名称表明该名称是神奇的:

SV *sv =  PadnameSV( PAD_COMPNAME( cPADOP->targ +ix ) );
do_sv_dump( 0, Perl_debug_log, sv, 0, 10, 0, 0 );

SV = PV(0x1c1ed40) at 0x1c1bb30
  REFCNT = 1
  FLAGS = (POK,pPOK,UTF8)
  PV = 0x19eb480 "@y"\0 [UTF8 "@y"]
  CUR = 2
  LEN = 10
  MAGIC = 0x1a58340
    MG_VIRTUAL = &PL_vtbl_arylen_p
    MG_TYPE = PERL_MAGIC_arylen_p(@)
    MG_FLAGS = 0x02
      REFCOUNTED
    MG_LEN = 8
    MG_PTR = 0x19eb460 "\0\0\0\0\0\0\0\0"
  ARRAY = 0x0
  FILL = -1
  MAX = -1
  ARYLEN = 0x0
  FLAGS = (REAL)

为什么我们需要变量名称的魔法?这是为了什么?

0 个答案:

没有答案