Michael Brennan wrote:
Hi,
does the standard say if the isalpha, isdigit, etc. functions
in ctype.h are functions or macros?
My old pre-ansi book says they are macros,
but I've seen man pages that say they are
functions and others that say they're macros.
The Standard describes them as functions. However, the
Standard allows an implementation to provide "masking" macros
for any Standard functions, so long as they behave the same
way the functions themselves do. (Almost "the same," that is:
A macro expansion need not have the same sequence points an
actual function call would, and the masking macros for a few
functions like getc() are allowed a little more leeway.)
If an implementation provides a masking macro for a function,
it is not relieved of the responsibility to provide the actual
function, too. This ensures that you can call the function via
a function pointer even if a macro substitution would be used in
"open code." You can also force the function to be used instead
of the macro by writing, e.g., (sqrt)(42.0) instead of sqrt(42.0).
--
Eric Sosman
es*****@acm-dot-org.invalid