[Info-vax] C str calls

Craig A. Berry craigberry at nospam.mac.com
Sat Aug 22 13:24:02 EDT 2015


On 8/22/15 11:49 AM, Stephen Hoffman wrote:
>
> Where available, the BSD-derived strl string calls can be preferable to
> the str calls and even to the strn calls, as the strl string calls are
> intended to avoid various common buffer overruns.

Though oddly these did not make it into C11, which instead adopted
strcpy_s, strcat_s, etc., first introduced by Microsoft about ten years
ago. I believe some people consider these preferable to the strl*
functions because the return value tells you whether or not you hit the
limit of the buffer and were truncated, whereas with strlcpy and friends
you have to compute that yourself using the returned length.




More information about the Info-vax mailing list