On 08/18/2011 01:37 PM, Bernard Helyer wrote:
I asked the Ars forums ( http://arstechnica.com/civis/viewtopic.php?
f=20&t=1153378&p=21965411 ) and I ask the same of you: should
unambiguously unreachable code be an error or a warning? ( see the linked
forum post for more details ).

The trouble with making dead code an error in general is that the compiler is not able to detect dead code in most cases. If it is considered an error, each instance of dead code that the compiler cannot detect could be considered an accepts-invalid bug.

Also, since the compiler is allowed to assume that any assert(0); is dead code, assert(0) would always be a compile time error. =)

if(__ctfe){
    // dead code during runtime goes here
}else{
    // dead code during compile time goes here
}

But I think making

goto label;
statement;
label:

An error would imho be ok, if you think it is worth the deviation from the reference implementation.

Reply via email to