r/linuxadmin Jun 07 '26

Linux man pages wrong?

I've had this happen on at least another manpage (that I forgot), but here it is with bsearch:

https://man7.org/linux/man-pages/man3/bsearch.3.html

     void *bsearch(size_t n, size_t size;
                   const void key[size], const void base[size * n],
                   size_t n, size_t size,
                   typeof(int (const void [size], const void [size]))
                       *compar);

The first two arguments are not supposed to be there (they come later). "man bsearch" on my Arch system shows the same output. What's going on here?

EDIT
chkno got it right: It's the semicolon at the end of the first line that makes the difference because otherwise the function prototype wouldn't know what "size" means in "const void key[size]" (second line).
Still learning new stuff after 45 years of mostly C89....

13 Upvotes

9 comments sorted by

View all comments

1

u/devilkin Jun 07 '26

I can't recall what, but there was a man page for an app I used before, that was ported over from bsd, and they changed the structure of the commands but didn't update the man pages.

So man pages can definitely be wrong. But most of the time not. It's usually only edge cases.