I should have clarified what I mean by "unreachable".  I am referring to user 
code that is orphaned in a standard control flow graph construction, which does 
not perform any optimizations based on the values of expressions.  The 
following has unreachable code:

  return 42;
  return -1; // unreachable

The following does not (from the blog post: "use 'if (false)' all you want"):

  if (false) {
    return -1;
  }

And the following, which allows you to bypass an existing function definition 
does not:

  if (true) {
    return -1;
  }

We call that "dead code" and in particular "intentional" because it's obvious 
from how it's written that the programmer intended to disable some code.  The 
reason for disallowing unreachable code is that it's too easy get accidentally, 
which also makes the intent unclear.


-- 
Peter Dillinger, Ph.D.
Software Engineering Manager, Coverity Analysis, Software Integrity Group | 
Synopsys
www.synopsys.com/software
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to