4 ms·
If you've debugged the problem to the point where you know +5 will be sufficient, you should know enough to fix the bug that required it in the first place.
by mark-r 6y ago
If you've debugged the problem to the point where you know +5 will be sufficient, you should know enough to fix the bug that required it in the first place.
- kfichter 6y agoOr, at the very least, know enough about the problem to leave a comment that properly explains why you're unable to fix the bug.
- SkyPuncher 6y agoI disagree. You can certainly fix known knowns, but you can't fix unknown unknowns. Sometimes its safer to simply apply a rule that you have confidence will work everywhere than fix that may introduce unsuspecting problems.
- mark-r 6y agoHow do you get that confidence without tracking down the root cause?
- SkyPuncher 6y agoI never said that you don't track down a root cause. Once you identify a root cause, you can assess the scope. "allocate 5 bytes more than you need" is a pretty broad reaching fix. I'd be very hesitant to implement it without proper time to fix.
- Arnavion 6y agoIt's not a bug. It's a public API and the buffer is an input from the caller. Nothing goes wrong if the buffer is smaller than it ought to be. The doc comment is just warning the caller they might need a larger buffer than they think they do.
- mark-r 6y agoI read the comment as saying there's another call which gives you a recommended buffer size, but the value returned isn't always sufficient. That sounds very much like a bug to me. It could be a tweet just doesn't give enough context to know what the real problem is.
- Arnavion 6y ago>It could be a tweet just doesn't give enough context to know what the real problem is. The comment you originally replied to has a direct link to the (commit that added the) code in question.