, - .
(Ubuntu 17.04, x86_64, clang 4.0.0) :
$ clang -std=c99 -pedantic-errors -Wall -Wextra min.c
min.c:5:24: warning: implicit declaration of function 'strnlen' is invalid in C99 [-Wimplicit-function-declaration]
printf("%d\n", (int) strnlen("hello world", 5));
^
1 warning generated.
$
strnlen
, C, . , str
, wcs
mem
, , <string.h>
.
C99 7.1.3p2 :
, ( 7.1.4) , undefined.
: M.M, strnlen
; . .
undefined (), . , , .
, , . , stpcpy
POSIX, . -std=c99 -pedantic-errors
:
#include <stdio.h>
#include <string.h>
int main(void) {
char s[10];
stpcpy(s, "hello");
puts(s);
}
.