C++ vs D: Default param values and struct to array casting

Maximillian maxmill at gmail.com
Sat Sep 7 11:22:09 UTC 2019


On Friday, 6 September 2019 at 18:31:29 UTC, Ali Çehreli wrote:
> ...
>   void enforceMemberWiseEquality(Demo d, const(float)[] values) 
> {
>     switch (values.length) {
>     case 4:
>       assert(d.d == values[3]);
>       goto case;
>
>     case 3:
>       assert(d.c == values[2]);
>       goto case;
>
>     case 2:
>       assert(d.b == values[1]);
>       goto case;
>
>     case 1:
>       assert(d.a == values[0]);
>       goto default;
>
>     default:
>       break;
>     }
>   }

Please could you tell what "goto case;" do here?

Max


More information about the Digitalmars-d-learn mailing list