in reply to Re: if else and not reachable coding style
in thread if else and not reachable coding style
It is not “should never reach this” but “cannot ever reach this”,
It depends. If someone modifies the code and does not put the requisite return in the right place, then you will get to that die statement.
That said, I’m not a fan either. Having that guard there is only useful If the branches are sp long that there’s a real chance that the screw-up it is supposed to protect against may happen. However, I’d prefer never to let the branches get that long to begin with.
Makeshifts last the longest.
|
|---|