Labels as values and threaded-code interpretation

Timon Gehr timon.gehr at gmx.ch
Sat Jun 1 09:12:11 PDT 2013


On 06/01/2013 11:43 AM, bearophile wrote:
> Alex Rønne Petersen:
>
>>             final switch (insn.op)
>>             {
>>                 case imm: lbl = &&handle_imm; break;
>>                 case add: lbl = &&handle_add; break;
>>                 case sub: lbl = &&handle_sub; break;
>>                 // ...
>>                 case ret: lbl = &&handle_ret; break;
>
> Regarding the syntax, why do you use "&&"? Isn't a single "&" enough?
>
>                  case imm: lbl = &handle_imm; break;
>
> If such gotos become a natural part of the D syntax then it's not
> necessary to copy the GNU C syntax.
>
> Bye,
> bearophile

D (like C) uses a different namespace for labels and symbols that are 
not labels.

This compiles today:

void main(){
     int foo;
     foo: auto b = &foo;
}



More information about the Digitalmars-d mailing list