Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


But 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: