News for hackers. Stuff that matters.
Re:Humans should think of sizeof() as a function, says Linus... by masklinn on Saturday May 30, 2015 @07:26AM (#9629801)
Except sizeof is a compile-time operation, not runtime. If sizeof were a function,

    int *foo = malloc(sizeof(*foo));
would make no sense.
Re:Humans should think of sizeof() as a function, says Linus... by barrkel on Saturday May 30, 2015 @08:14AM (#9629910)
Compile-time functions are a thing. Not in C, but in other languages, including C++.

This all comes down to what you think "function" means. If you're living in a C bubble, of course sizeof isn't a function. If you have a wider mapping (!) for the word, then it is a kind of function.

Re:Humans should think of sizeof() as a function, says Linus... by mcguire on Saturday May 30, 2015 @11:30AM (#9630468)
If you think everything called a "function", in every context, is the same thing, you are going to have a very bad day.
Re:Humans should think of sizeof() as a function, says Linus... by userbinator on Saturday May 30, 2015 @09:15AM (#9630064)
In C99, sizeof is compile-time only if VLAs are not involved.

In C89, sizeof is always compile-time.

Re:Humans should think of sizeof() as a function, says Linus... by rdc12 on Saturday May 30, 2015 @07:44AM (#9629843)
So in practice it works more like a C Macro then a C function?

Edit, except it doesn't treat arguments the same, so no.

Re:Humans should think of sizeof() as a function, says Linus... by cygx on Saturday May 30, 2015 @09:21AM (#9630080)
It's neither:

sizeof belongs in its own category of unary compile-time(-ish) operators, whose only other member is _Alignof.

If you're so inclined, you might add _Generic and _Pragma to that mix as well, but they aren't really a close fit.