3 ms·
This is, at best, clumsily worded, because it requires that the reader hold two negatives simultaneously. "If the container is not empty, the function never thr
by tialaramex 4y ago
This is, at best, clumsily worded, because it requires that the reader hold two negatives simultaneously. "If the container is not empty, the function never throws"
How about this:
If the container is empty the function causes undefined behaviour. Otherwise it never throws exceptions (no-throw guarantee).
We avoided having to hold two negatives, and we also put the thing you need to care about up front where it's more likely to be noticed.
- chipsa 4y agoThe function never throws, whether empty or not. So, skip the "otherwise".
- tialaramex 4y agoIt's not called "Undefined except we promise it can't possibly throw" behaviour.