This is done both for clarity and for future compatibility.
If you have the structure:
struct confd_data_cbs {
TypeA callpoint;
TypeB get_object;
TypeC get_next;
};
But at some point later change the definition like so:
struct confd_data_cbs {
TypeA callpoint;
TypeD set_object; /* New Field Added */
TypeB get_object;
TypeC get_next;
};
Then any initializers that don't specify the field names will no longer work.
The ssd_common_get_object
will get assigned to set_object
, and get_next
will be left uninitialized since the order of the fields changed!
When you specify the field names, you know the right fields are getting initialized, even if the order or number of fields changes later.