Invoking pointers to functions (C sytle)

Karl Heuer karl at ima.isc.com
Wed Dec 12 16:56:16 AEST 1990


In article <2284:Dec1001:01:4690 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>What's common to your two models is that both involve kludges,

I don't think that's avoidable, given the semantics.

>(c) Functions and pointers are logically distinct types. Note that the
>name of a function refers to type pointer-to-function, *not* function.
>...Any pointer-to-function in a & context is left alone.

Doesn't work.  You need to have `&f' yield pointer-to-function, while `&pf'
yields pointer-to-pointer-to-function.  Thus, `f' and `pf' must have different
types in an lvalue context.

>It has the advantage of being more realistic---at the machine level you call
>functions by address, not by value.

If we were to continue in that vein, I'd also have to say that the left
operand of the assignment operator should logically be a pointer instead of an
lvalue.  That way lies BLISS.

Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list