I am using a structs for storing different configurations and I would like to force the initialization of all members. I mean not let the compiler do it (to zero), but the progammer explizitly.
A compiler error would be best but a warning would be fine as well. I am using Segger clang for arm.
Any tips about how to achieve this?
Since I would like to use designated initializers, -Wmissing-field-initializers does not work in this case. See: Docs
typedef struct{
int option_1,
int option_2,
....
} config_t;
// this is fine
const config_t config_1 = {
.option_1 = 10,
.option_2 = 20,
};
// this should generate a warning
const config_t config_1 = {
.option_2 = 20,
};