|
|
|
|
|
by Someone
1339 days ago
|
|
I don’t think that’s a good name for this. Clearly, that code can be reached. From the name, I would expect ”throw new UnreachableException” to be something the compiler inserts to make it more robust in the sense that, if the compiler has some bug in its control flow analysis, it throws, rather than executes the wrong code. Now, for a better name? Maybe ShouldNeverGetHereException, but that may be seen as too whimsical. |
|
It doesn't seem like .Net is implementing it correctly either. It is supposed to be optimized away in release code, resulting in UB if the developer was wrong about the condition.