Where's the man page for the `sizeof` C function?

sizeof isn't a function. it's an operator: http://en.wikipedia.org/wiki/Sizeof


You 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 left

As 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

http://man7.org/linux/man-pages/man7/operator.7.html

Tags:

Linux

C

Man