... C builtin functions?

Jim Giles jlg at lanl.ARPA
Fri Apr 25 10:10:56 AEST 1986


In article <562 at nsc-pdc.UUCP> joemu at nsc-pdc.UUCP (Joe Mueller) writes:
>Sizeof is an operator, not a function. It's perfectly legal to say
>"sizeof foo" (without the parens).

An operator is a syntactic form that invokes a function!  SIZEOF is clearly
a function: it has a domain (actually two domains - data types and variables)
and it has a range (the non-negative integers) and it provides a mapping
from one to the other.  Since that is the mathematical definition of the
word 'function', it is clear that SIZEOF is one.  Now, it is true that
the syntactic description of C uses the term 'function' in a slightly
more restrictive way.  But the guy that wrote the syntactic description
of C just picked 'function' as a convenient name for a grammar rule.  If
you take it too literally, you will start saying absurd things like "'+'
is an operator and not a function."  Most people I know would be quite
surprised about that!

J. Giles
Los Alamos



More information about the Comp.lang.c mailing list