Comment Comment by rwmj > the main caveat regarding designated initializer usage is that initialized members must appear in declaration orderI hate this about C++! In C you can initialize them in any order, and this allowed us to write nbdkit plugins in a very natural way: static struct nbdkit_plugin plugin = { .name = "myplugin", .open = myplugin_open, .get_size = myplugin_get_size, .pread = myplugin_pread, .pwrite = myplugin_pwrite, /* etc */ }; where the order is not related to the order the fields appear in the struct (that has to be maintained for ABI reasons), and not all fields need to appear (the others are initialized with 0/NULL).For C++ we have to do this mess:https://bugzilla.redhat.com/show_bug.cgi?id=1418328#c3Anyway my question is .. why is this, C++ people? parent rwmj 2 years ago
I hate this about C++! In C you can initialize them in any order, and this allowed us to write nbdkit plugins in a very natural way:
where the order is not related to the order the fields appear in the struct (that has to be maintained for ABI reasons), and not all fields need to appear (the others are initialized with 0/NULL).For C++ we have to do this mess:
https://bugzilla.redhat.com/show_bug.cgi?id=1418328#c3
Anyway my question is .. why is this, C++ people?