I hit some c code in Linux kernel:
static struct ctl_table ip_ct_sysctl_table[] = {
{
.procname = "ip_conntrack_max",
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
// ...
{
.procname = "ip_conntrack_log_invalid",
.maxlen = sizeof(unsigned int),
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &log_invalid_proto_min,
.extra2 = &log_invalid_proto_max,
},
{ }
};
Here an array of structs ends with { }
. For what purpose was it added?
By the way, a bit above this code there is another array of structs, but without empty braces at the end.
When should I use empty braces at the end of an array of structs?
-pedantic
.