Why is std.algorithm so complicated to use?

Ali Çehreli acehreli at yahoo.com
Mon Jul 9 16:41:15 PDT 2012


On 07/09/2012 04:20 PM, Timon Gehr wrote:
 > On 07/10/2012 12:53 AM, Jonathan M Davis wrote:

 >> dmd is generally good about not having
 >> useless warnings.
 >
 > case 0,1: // warning: switch fallthrough (nonsense)
 > case 2,3:
 >
 > This is the only kind of warning I get (clearly a bug, and it is
 > reported).

I thought the code above was illegal at least in 2.059. I get an error 
unless I use goto case:

void main()
{
     int i;
     int j;

     switch (i) {
     case 0,1:
         goto case;  // goto, embraced by D :)

     case 2,3:
         j = 42;
         break;

     default:
         j = 43;
     }
}

Ali



More information about the Digitalmars-d mailing list