Why is std.algorithm so complicated to use?
Timon Gehr
timon.gehr at gmx.ch
Mon Jul 9 16:46:35 PDT 2012
On 07/10/2012 01:41 AM, Ali Çehreli wrote:
> 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.
You can write the code as
case 0: case 1: case 2,3:
and be ok.
> 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
>
The error only shows up if -w is used.
More information about the Digitalmars-d
mailing list