You can even stick with only one "save" function and just simulate defaults. Say your function has the signature

void save(X,Y,Z)

where X, Y and Z are some types, and you would like to simulate

void save(X,Y, Z,bool=false)

where setting the bool parameter to true would cause the new behaviour - no popup on failure, but storing the error message in a global variable save_last_error. To do this in C, you would use a variable argument list, i.e.

void save(X,Y,...)

and use va_arg to scan for the parameters which are present, and deduce the value of the bool from it.


Reply to this email directly or view it on GitHub.