SirWumpus / post4

Post4 is an indirect threaded Forth dialect written in C.
BSD 2-Clause "Simplified" License
4 stars 1 forks source link

Compile error: call to undeclared function 'strncasecmp' #35

Closed tcort closed 1 month ago

tcort commented 1 month ago
post4.c:982:6: error: call to undeclared function 'strncasecmp'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                && strncasecmp((char *)word->name.string, caddr, length) == 0) {

system:

Darwin megatron.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64

compiler:

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

From the man page:

HISTORY
     The strcasecmp() and strncasecmp() functions first appeared in 4.4BSD.  Their prototypes existed previously in <string.h> before they were moved to <strings.h> for IEEE Std 1003.1-2001 (“POSIX.1”) compliance.

The configure script checks for strings.h and defines HAVE_STRINGS_H but there is no include in post4.h for strings.h.

SirWumpus commented 1 month ago

Oh dear, now I shall suppose I have to use force. Marvin The Martian.

Woot!? #include <strings.h>, grrr, damn inconvenient; string functions should be confined to one include. What's the point of a standard if it doesn't standardise. Blasters at the ready.