You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I wonder if there is any chance to make const-qualification of parameters in some exported functions?
For example, change cfg_getopt(cfg_t *cfg, const char *name); to cfg_getopt(const cfg_t *cfg, const char *name);.
This will allow to write more const (pure) functions, especially in C++ projects. However, it will be require to change the error reporting function prototype from: typedef void (*cfg_errfunc_t)(cfg_t *cfg, const char *fmt, va_list ap);
to typedef void (*cfg_errfunc_t)(const cfg_t *cfg, const char *fmt, va_list ap);
While I see no reason to change cfg_t data inside the callback for custom error reporting, I suppose there might be use cases for this. The above changes may also break backward compatibility. But the tests of this project pass successfully after such changes on my local machine.
The text was updated successfully, but these errors were encountered:
Hi! I wonder if there is any chance to make const-qualification of parameters in some exported functions?
For example, change
cfg_getopt(cfg_t *cfg, const char *name);
tocfg_getopt(const cfg_t *cfg, const char *name);
.This will allow to write more const (pure) functions, especially in C++ projects. However, it will be require to change the error reporting function prototype from:
typedef void (*cfg_errfunc_t)(cfg_t *cfg, const char *fmt, va_list ap);
to
typedef void (*cfg_errfunc_t)(const cfg_t *cfg, const char *fmt, va_list ap);
While I see no reason to change
cfg_t
data inside the callback for custom error reporting, I suppose there might be use cases for this. The above changes may also break backward compatibility. But the tests of this project pass successfully after such changes on my local machine.The text was updated successfully, but these errors were encountered: