When designing a C API for configuring a library/utility, I have a co-worker who prefers to lump all configuration parameters into 1 function call. For example:
int set_diagnostic_email_config( char *to_address,
bool include_timestamp,
bool send_for_crashes,
bool send_daily_status,
bool send_on_event1,
bool send_on_event2 )
A similar "get" function exists with many parameters.. The main advantage of this method is that if someone adds a new option, e.g., "bool send_on_event3", then because the prototype changed you are forced to update every place this function call is used (assuming there are multiple places where people call this).
I prefer something along the lines of:
int get_diagnostic_email_config( struct email_config *p_config );
int set_diagnostic_email_config( struct email_config *p_config );
where you just change the structure elements as needed. But... if someone updates the email_config" structure it doesn't force people to update all the places where it is used (even though we often want to..). Plus my co-worker complains that if someone just tries to initialize "email_config" by hand, then if things get added later then those new fields will be uninitialized with no warnings.
Is there any strong consensus on which method is preferred? or perhaps there is another alternative I'm missing?