4 ms·
Often when I use this, it's to make it explicit that the normal/common case is met and the other clause is truly exceptional. It's also a stub where you can ad
by csixty4 7y ago
Often when I use this, it's to make it explicit that the normal/common case is met and the other clause is truly exceptional.
It's also a stub where you can add logging or similar along the normal path without touching the conditional and risking introducing bugs by accident.
Depending on the language or runtime the empty clause will likely be factored out by the optimizer so there's no cost for extra readability and flexibility.
- eps 7y agoPrecisely. This construct is used to indicate likely vs unlikely branches in code. It's a pretty common pattern.