Is there an opposite to stdargs?
Brian Brunswick
bdb at cl.cam.ac.uk
Sun Jul 1 12:44:53 AEST 1990
Is there a reasonably standard method available to do the opposite of what
stdargs/varargs does - ie have the run time type variation used not by the
callee, but by the caller? (I want to do this to implement a dynamic loading
system for an object orientated system.) What it would have to do would be build
up the parameters in a buffer array, and then pass that by value to the called
function, via a function pointer, which would probably be declared with a ...
prototype. Of course, wrap the array in a structure to get around C's brokeness
about arrays. Now this is quite easily written, but is definately non portable,
so is there already a macro interface to it somewhere that I could copy?
The trouble with this sort of implementation is that it ends up passing lots
of spurious gunge due to a fixed length array, and would be in deep trouble
with a system that took advantage of prototypes to (say) put doubles in fp
registers. Perhaps I should go to the method of passing a va_ whatever as the
vprintf etc. functions do, but I want to avoid complexity in the called
function.
Oh well. Any thoughts, contributions?
I will by default summarise any direct email, so please say if you would
object to this.
Brian Brunswick, bdb at uk.ac.cam.cl - Short .sig rules!
More information about the Comp.lang.c
mailing list