3 ms·
Failing perceptibly composes better than failing loudly. It's easy to go one way: char *strxxxcpy(char *restrict dst, const char *restrict src, size_t len) {
by saagarjha 5y ago
Failing perceptibly composes better than failing loudly. It's easy to go one way:
char *strxxxcpy(char *restrict dst, const char *restrict src, size_t len) {
char *result = strxcpy(dst, src, len);
assert(result);
return result;
}
but going in reverse is difficult.
- zbuf 5y agoBut that misses my point; the bug is that as a developer it's too easy to not write the correct check -- like exactly this one. The library function presented to most developers (especially a novice one) should reflect the most common case, not the more-easy-to-compose case.