5 ms·
This is a fairly common pattern but it suffers from a big problem in that the compiler usually can't check your parameters for correctness. If you build a stru
by jandrese 2y ago
This is a fairly common pattern but it suffers from a big problem in that the compiler usually can't check your parameters for correctness. If you build a struct with the parameters but accidentally misname one that error is hard to catch.
My ideal language would have function prototypes that look something like:
return_type function_name(parameter_name type (default_value) [constraints], ...)
If the default value is not set then the parameter must be passed or it is a compile error.