for code like this:
    switch (foo)
    {   case 1:
            CODE1
        case 2:
            CODE2
            break;
        case 3:
            CODE3
            break;
    }

Here is the pseudocode:

    break     = false
    fall_thru = false;

    if (!break && (foo == 1 || fall_thru))
        CODE 1
        fall_thru = true;
    endif
    if (!break && (foo == 2 || fall_thru))
        CODE 2
        fall_thru = true;
        break = true;       // emitted when 'break' is hit
        fall_thru = false; // emitted when 'break' is hit
    endif

-- MattWalsh - 08 Feb 2010

Topic revision: r1 - 08 Feb 2010 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback