I\'m trying to use C stdarg.h lib, with a generic type. The type int, is my generic type > to understand it, please, hold reading. So, my problem is:
I have a functi
Use a void * (or a typed structure) for each parameter & use a structure with a "type" argument (an integer). A pointer / union to contain the actual value.
In other words, each parameter is passed with a pointer to a typed structure. Each instance of this typed structure contains a value. The type of this "value" is contained in this typed structure.
Better Example:
typedef struct {
int type;
union {
int int_value;
double double_value;
...
};
} Param;
void function(Param *p1, Param *p2, ...)
The latest example of such trick I ran into was DBus.