11 ms·
I think there's an argument to be made that the way an API is implemented is an implicit contract that ought to be upheld. That sounds wrong to me. If your con
by ldh 16y ago
I think there's an argument to be made that the way an API is implemented is an implicit contract that ought to be upheld.
That sounds wrong to me. If your consumers have to rely on assumptions beyond what's provided in the contract of the API, your API is leaky and/or broken.
[edit] I understand the pragmatism necessary in the case of the glibc issue, but to clarify my point I disagree with the general assertion I'm quoting.
- devinj 16y agoRight, the memcpy() API is leaky because it leaves some things unspecified. You can deduce the implementation by providing various inputs to it that have "undefined behavior". This is a common problem in C, and there are usually functions that avoid it (Linus recommends memmove).