On Sun, Apr 11 2021, brian m. carlson wrote: > On 2021-04-11 at 11:57:30, Ævar Arnfjörð Bjarmason wrote: >> >> On Sat, Apr 10 2021, brian m. carlson wrote: >> >> > const struct object_id null_oid; >> > static const struct object_id empty_tree_oid = { >> > - EMPTY_TREE_SHA1_BIN_LITERAL >> > + EMPTY_TREE_SHA1_BIN_LITERAL, >> > + GIT_HASH_SHA1, >> > }; >> > static const struct object_id empty_blob_oid = { >> > - EMPTY_BLOB_SHA1_BIN_LITERAL >> > + EMPTY_BLOB_SHA1_BIN_LITERAL, >> > + GIT_HASH_SHA1, >> > }; >> > static const struct object_id empty_tree_oid_sha256 = { >> > - EMPTY_TREE_SHA256_BIN_LITERAL >> > + EMPTY_TREE_SHA256_BIN_LITERAL, >> > + GIT_HASH_SHA256, >> > }; >> > static const struct object_id empty_blob_oid_sha256 = { >> > - EMPTY_BLOB_SHA256_BIN_LITERAL >> > + EMPTY_BLOB_SHA256_BIN_LITERAL, >> > + GIT_HASH_SHA256, >> > }; >> >> In this and some other patches we're continuing to add new fields to >> structs without using designated initializers. >> >> Not a new problem at all, just a note that if you re-roll I for one >> would very much appreciate starting by migrating over to that. It makes >> for much easier reading in subsequent patches in this series, and in >> future ones. > > I'm happy to do that. I thought we were not allowed to use C99 features > because only recent versions of MSVC support modern C. I was previously > under the impression that MSVC didn't support anything but C89, but they > now support C11 and C17 in their latest release[0], much to my surprise. > > If we're willing to require C99 features, then I'm happy to add those. > I'll also send a follow-up series to require C99 support, which I think > is overdue considering the standard is 22 years old. > > [0] https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/ I don't think we can in general require C99, e.g. I found just the other day that our CI's MSVC will fail on %zu (to print size_t without %lu & a cast). But we can use some subset of C99 features, and happily designated initializers is one of those, see cbc0f81d96f (strbuf: use designated initializers in STRBUF_INIT, 2017-07-10). It's been used all over the place since then. See e.g.: git grep -P '^\s+\.\S+ = ' -- '*.[ch]'