I have a C function named SetParams(...)
with a variable number of arguments. This function sets up a static data structure (let us name it Data
). SetParams
is used with pairs of arguments, e.g. SetParams("paramA", paramA_value, "paramB", paramB_value)
etc. It can also be called many times, e.g.
SetParams("paramA", paramA_value);
SetParams("paramB", paramB_value);
...
When all 'parameters' have been set, another function is called (let us name it Execute
) that takes no args:
Execute();
// uses data from static 'Data' and performs error_handling and execution
I was wondering if I could structure this kind of code in a more object-oriented way. So, I would like some advice, especially for error-handling, since some pairs of args may contradict others.