This is an excellent pattern in C. The Dovecot mail server has many fine examples of the style as well e.g.<p><pre><code> struct dict dict_driver_ldap = {
.name = "ldap",
.v = {
.init = ldap_dict_init,
.deinit = ldap_dict_deinit,
.wait = ldap_dict_wait,
.lookup = ldap_dict_lookup,
.lookup_async = ldap_dict_lookup_async,
.switch_ioloop = ldap_dict_switch_ioloop,
}
};
</code></pre>
defines the virtual function table for the LDAP module, and any other subsystem that looks things up via the abstract dict interface can consequently be configured to use the ldap service without concrete knowledge of it.<p>(those interested in a deeper dive might start at <a href="https://github.com/dovecot/core/blob/main/src/lib-dict/dict-private.h" rel="nofollow">https://github.com/dovecot/core/blob/main/src/lib-dict/dict-...</a>)