c types problem

G|sta Simil{/ml gostas at kuling.UUCP
Fri Jan 3 14:29:13 AEST 1986


I need to define a type for a program which can store any of the types
long, int, short and also the unsigned variants of them.
Some of the routines referencing this types will not use them directly
however, it will use the sys/types.h typedefs dev_t, time_t etc.
It will look something like this: "(*func)(&data)" there *func,
but not the calling routine knows what type is currently stored in "data".
The formal (but ugly) way to solve this would proparbly be to use a union
for all (about 10) types. But now I wonder if anyone have a simpler but
resonably portable solution?

	G|sta Simil{				gostas at kuling.UUCP



More information about the Comp.lang.c mailing list