Unconditional loop exists

bearophile bearophileHUGS at lycos.com
Tue Aug 13 07:56:29 PDT 2013


Are situations like this, that are potential signs of 
bugs/mistakes, worth reporting with warnings?


int foo() {
     // Unconditional 'break' within a loop:
     foreach (immutable _; 0 .. 10) {
         //...
         break;
     }

     // Unconditional 'return' within a loop:
     foreach (immutable _; 0 .. 10) {
         //...
         return 0;
     }

     assert(0);
}


Bye,
bearophile


More information about the Digitalmars-d mailing list