unreachable-code

Unreachable code error vs. dead code warning in Java under Eclipse?

Does anyone know why: public void foo() { System.out.println("Hello"); return; System.out.println("World!"); } Would be reported as an "unreachable error" under Eclipse, but public void foo() { System.out.println("Hello"); if(true) return; System.out.println("World!"); } Only triggers a "Dead code" warning? ...

Scala compiler says unreachable code, why?

I'm new to Scala... Here's the code: def ack2(m: BigInt, n: BigInt): BigInt = { val z = BigInt(0) (m,n) match { case (z,_) => n+1 case (_,z) => ack2(m-1,1) // Compiler says unreachable code on the paren of ack2( case _ => ack2(m-1, ack2(m, n-1)) // Compiler says unreachable code on the paren o...

While within a switch block

Hi, I've seen the following code, taken from the libb64 project. I'm trying to understand what is the purpose of the while loop within the switch block - switch (state_in->step) { while (1) { case step_a: do { if (codechar == code_in+length_in) { st...

How to hint to GCC that a line should be unreachable?

It's common for compilers to provide a switch to warn when code is unreachable. I've also seen macros for some libraries, that provide assertions for unreachable code. Is there a hint, such as through a pragma, or builtin that I can pass to GCC (or any other compilers for that matter), that will warn or error during compilation if it's ...