Feature Request: Label assignment / type

Janice Caron caron800 at googlemail.com
Sat Nov 17 10:30:12 PST 2007


On 11/17/07, Joe Pusdesris <deformative0 at gmail.com> wrote:
> I just find it easier for things like jump tables and to specify a point to
> return to after finishing a block,  but if no one else likes it that's cool
> too.

switch statement often compile to jump tables. Or at least, they did
in C - I've no idea what the D compiler does. So instead of

    Label a = label2;
    goto a;

    label1:
        /* stuff */

    label2:
        /* stuff */

you do

    enum Label { label1, label2 };
    Label a = label2;
    switch (a)
    {
    case label1:
        /* stuff */

    case label2:
        /* stuff */
    }

It all boils down to the same thing.



More information about the Digitalmars-d mailing list