I personally would do it like this:
1) send a pointer to void * as the first parameter
2) send a second parameter that tells you what void * means (an enumeration for possibilities) and sets parameter 1 for this
This will force you to write ugly code with a lot of switches, but it can work if everything is done carefully and thoroughly tested.
Sort of:
BYTE_VALUE = 1; INT_VALUE = 2, CHAR_VALUE = 3 etc
int parse(void *arg, enum_type arg_type)
{
if (arg == NULL) return -1;
switch(arg_type)
{
case BYTE_VALUE:
byte value = (byte) *arg;
case INT_VALUE:
}
return something;
}
Edit: It is assumed that you do not want the variational functions (which did not seem to be what you wanted)
laura source
share