Statement is unreachable error

deadalnix deadalnix at gmail.com
Mon Jun 3 07:53:22 PDT 2013


I reach this error all the time. When debugging for instance, I 
may want to stick a throw in the middle of some code, or 
whatever, and get into it, have to go back to the code, comment 
bunch of stuff, go back to compile.

This is something that is obviously important to have, but I 
think to have it by default is really annoying.

In addition, it tends to kick in when using static if. See sample 
code below :

uint foo() {
     static if(condition) {
         return 0;
     }

     // Do some computation.
     return value;
}

Now, if you want that piece of code to compile, you got to stick 
the whole function body into an else, and it really make the code 
unreadable sometime when you got static ifs within other static 
ifs.

Can we at least disable the feature for termination of control 
flow that belongs to different compile time scope ?


More information about the Digitalmars-d mailing list