How come there's no man page for the sizeof C function?
$ man 3 sizeof
No manual entry for sizeof in section 3
$ man sizeof
No manual entry for sizeofI do see man pages for other C functions like malloc if I run man 3 malloc and similar commands, but nothing for sizeof.
2 Answers
sizeof isn't a function. it's an operator:
4You can use man -wK 'sizeof' | sort -u to find the articles that contain sizeof, but that'll return a lot of results. However notice that every article about something will have that thing as a bareword surrounded by spaces, we'll search for the article like this zgrep -P '\ssizeof\s' /usr/share/man/man3/*. But searching in section 3 doesn't give any useful information, so I'll search in section 7
$ zgrep -P '\ssizeof\s' /usr/share/man/man7/*
/usr/share/man/man7/inotify.7.gz: len = read(fd, buf, sizeof buf);
/usr/share/man/man7/operator.7.gz:! ~ ++ \-\- + \- (type) * & sizeof right to leftAs you can see, the sizeof is mentioned in the operator man page, because it's not a function but an operator and it works even without parentheses for identifiers like sizeof buf above
OPERATOR(7) Linux Programmer's Manual OPERATOR(7)
NAME top operator - C operator precedence and order of evaluation
DESCRIPTION top This manual page lists C operators and their precedence in evaluation. Operator Associativity () [] -> . left to right ! ~ ++ -- + - (type) * & sizeof right to left * / % left to right + - left to right << >> left to right < <= > >= left to right == != left to right & left to right ^ left to right | left to right && left to right || left to right ?: right to left = += -= *= /= %= <<= >>= &= ^= |= right to left , left to right