stdarg

Brian Fennell fenn at wpi.WPI.EDU
Fri Feb 8 01:18:28 AEST 1991


The answer to the original question appears to be, "You usually don't 
really need to, and here's how to fake it...."  (See above)

Here is an example of something that is not too far fetched that
really does want 0 _fixed_type_ arguments.  I am programming in X windows.
most of the routines I use want to refer to a specific instance of a
widget pseudo-object.  This results in many lines that redundantly
refer to the same widget, sometimes twenty lines in a row.  I decide
to use a global, much like printf uses a global called stdout.
I have one routine that resets the one or two necessary parameters
for the current widget, these might be integers, strings, or even
in an unusual case doubles, depending on the class of my global.  In 
this example (which I am currently working with in real life) the 
stdarg.h standard falls short of the vararg.h standard.

Truth be told, I could use all pointers, but this makes using double
constants such as M_PI a bit of a pain.  I could also use a macro
to pass the sizeof() as first argument but macros don't take variable
number of arguments.

Brian Fennell == fenn at wpi.wpi.edu



More information about the Comp.lang.c mailing list