Addresses of static functions

Norman Diamond ndiamond at watdaisy.UUCP
Thu Jan 31 04:35:04 AEST 1985


> The original question was, "Is it OK to take the address of a >>static<<
> function, and pass it to a separately-compiled function?"
> 
> This problem arose practically in Version 2.0 of the Venix system for the
> IBM PC/XT ...  they require a special form of call for inter-segment calls,
> which they do not use for static calls, since they are guaranteed to remain
> within a single segment.
> 
> In reality, the answer might have to be "yes", making the Venix code in error.
> The reason is that a function may invoke another function by address.

I think that Venix is in error, for exactly this reason.  They (and their
customers) have not been the only Intel users to be burnt by this quirk, and
C is not the only language in which this problem exists.

If the address of the function is taken, anywhere in the source module, then
the compiler should generate long calling sequences for the function.

-- Norman Diamond

UUCP:  {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy at waterloo.csnet
ARPA:  ndiamond%watdaisy%waterloo.csnet at csnet-relay.arpa

"Opinions are those of the keyboard, and do not reflect on me or higher-ups."



More information about the Comp.lang.c mailing list