Hello guys,

what would be the best way to ensure that variadic arguments passed to my function are indeed the type they're supposed to be?

I'm detecting the type internally, by parsing a string which is supposed to contain characters that identify the type of each argument, e.g 'i' or 'd' for integers, 'u' for unsigned ' f' for float, etc.

However, I want to be able to detect if the user calls my function passing the wrong arguments for the given type specifiers.

One would think that when assigning va_arg(va_list, type) to a variable of the wrong type, there would be an error, but if we are dealing with a simple integral conversion there would be no error then. Not to mention the fact that I would like to store the arguments in a void*, to make things neater and more concise. Then I'd use the type to decipher the void* when I'd need it.

I thought about using sizeof but I quickly dismissed it as being unfeasible.
I'm at a loss here so I welcome any ideas you might have.

Thank you!