Close

strings in C

yann-guidon-ygdesYann Guidon / YGDES wrote 05/06/2023 at 03:58 • 1 min read • Like

I'm 46 years old and only now do I realize that there is <strings.h> and <string.h>

WTF.

Like

Discussions

Carlos Alberto Monteiro d wrote 05/15/2023 at 04:06 point

Pcb big piano

  Are you sure? yes | no

Ken Yap wrote 05/06/2023 at 10:33 point

Which means you're too young to have experienced the dual standards of BSD and SysV library routines. Nowadays the SysV str* and mem* routines prevail and the BSD b* and *index routines in <strings.h> are deprecated.

  Are you sure? yes | no

Yann Guidon / YGDES wrote 05/06/2023 at 10:35 point

but bzero is still used right ?

And thanks for the "too young" bit ;-) at 46 I appreciate ;-)

  Are you sure? yes | no

Ken Yap wrote 05/06/2023 at 10:45 point

bzero can be replaced by memset, and the man page even recommends it. As for the extra argument, I wouldn't be surprised if a compiler can optimise a memset with a constant byte of 0.

  Are you sure? yes | no