To dereference or not dereference

Guido van Rossum guido at boring.uucp
Mon Mar 24 12:13:28 AEST 1986


If I were to redesign C, function names would just be constant pointers
to pieces of code, just like array names would be constant pointers
(though alas they aren't because of sizeof -- sizeof for functions is
undefined anyway).  The syntax for a function call would require an
expression of type function pointer to the left of the parenthesis.
Function pointers couldn't be dereferenced.  (I might leave unary * and
& applied to functions in the language to achieve compatibility with
existing programs.)

It has been said that now one can't see whether f() calls a function
named f or a function whose address resides in function pointer variable
f -- it this really important?  You don't know for array names or macros
either (does a+1 reference variable a or macro a?  If the answer is that
macros should be upper case, sulerly you can invent a convention whereby
to recognize function pointers).

	Guido van Rossum, CWI, Amsterdam (guido at mcvax.UUCP)



More information about the Comp.lang.c mailing list