In code example of Intel DPDK i have found this strange syntactical construction. Can anybody explain me what does it mean?
static const struct rte_eth_conf port_conf = {
.rxmode = {
.split_hdr_size = 0,
.header_split = 0,
.hw_ip_checksum = 0,
.hw_vlan_filter = 0,
.jumbo_frame = 0,
.hw_strip_crc = 0,
},
.txmode = {
}
};
If you have
you can initialize an object like this:
But this means you need to know the order of variables in
Xas well as having an initial value for all of it. Alternatively, you can initialize like this:This way, you can initialize member variables in any order, or even skip some.
This is specially useful in a library where you have some variables needed to be initialized by the user, while other variables are more internal and could even be changed with different versions of your library. Using this kind of initialization, the user doesn’t need to know about those extra variables.