Why is the isnumber() function present in certain distros of Unix but not in others?

c, compiler-construction, linux, macos, unix

Solution

`isnumber()` is a BSDism, as can be seen in the HISTORY section of the linked man page:

The isnumber() function appeared in 4.4BSD.

And there OS X shows its heritage...

Also there is a STANDARDS section that talks about `isdigit` but mutes about `isnumber`.

Anyway, Linux, BSD or OS X man pages should not be considered authoritative about the C language, or even about the POSIX standard. For C read the C standard specification (easy to find around), and for POSIX you can read the OpenGroup web site.

Problem

I'm writing a small C program in which I call the `isnumber()` function. ``` #include <ctype.h> char c if(isnumber(c)) { foo } ``` This compiles without a problem on my Mac (OS X 10.8). However, when I upload it to a CentOS 6.x server, it won't compile. Furthermore, the OS X `man` page for `isdigit()` describes `isnumber()`, but the CentOS `man` page does not. It's as if it simply doesn't exist on the Linux box. Both the OS X `man` page for `isdigit()` and a general Unix `man` page for `isdigit()` have `isnumber()` listed as part of the C standard library `libc, -lc`. When I add `-lc` to the compile flags on Linux, it still won't compile. Why is this function included in certain forms on Unix and not in others?

Original source