[erlang-questions] marco definition in beam_emu.c
Nahuel Greco
ngreco@REDACTED
Tue Sep 6 18:01:18 CEST 2011
Thats the gcc (or C99?) way to mark you want to evaluate a macro
variable when is in contact with another string, so if you define:
#define OpCase(OpCode) case op_##OpCode: lb_##OpCode
#define OpCase2(OpCode) case op_OpCode: lb_OpCode
OpCase(444) will be translated to "case op_444: lb_444"
OpCase2(444) will be translated to "case_OpCode: lb_OpCode", and
surely you don't want that.
Saludos,
Nahuel Greco.
On Tue, Sep 6, 2011 at 12:50 PM, caox <caox@REDACTED> wrote:
> Hi
> When reading the source code of beam_emu.c, I found the following marcos:
> #if defined(NO_JUMP_TABLE)
> # define OpCase(OpCode) case op_##OpCode: lb_##OpCode
> # define CountCase(OpCode) case op_count_##OpCode
> # define OpCode(OpCode) ((Uint*)op_##OpCode)
> # define Goto(Rel) {Go = (int)(Rel); goto emulator_loop;}
> # define LabelAddr(Addr) &&##Addr
> #else
> # define OpCase(OpCode) lb_##OpCode
> # define CountCase(OpCode) lb_count_##OpCode
> # define Goto(Rel) goto *(Rel)
> # define LabelAddr(Label) &&Label
> # define OpCode(OpCode) (&&lb_##OpCode)
> #endif
> which I couldn't understand. What is the meaning of 'op_##' and 'lb_##'?
> BR
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
More information about the erlang-questions
mailing list