Re: [PATCH] strbuf: use designated initializers in STRBUF_INIT
- From
Ben Peart <peartben@gmail.com>
- Date
- Jul 10, 2017, 17:57 UTC
- Message-ID
- <15867357-5b3f-b12e-8bc3-125b3f2f18f0@gmail.com>
- In-Reply-To
- <20170710160432.4mmcoqh7yi5cqdhy@sigill.intra.peff.net>
On 7/10/2017 12:04 PM, Jeff King wrote:
Show 13 quoted lines
> On Mon, Jul 10, 2017 at 10:57:57AM -0400, Ben Peart wrote: > >>> If this patch can survive a few releases without complaint, >>> then we can feel more confident that designated initializers >>> are widely supported by our user base. It also is an >>> indication that other C99 features may be supported, but not >>> a guarantee (e.g., gcc had designated initializers before >>> C99 existed). >> >> Correct. MSVC also supports designated initializers but does not fully >> support C99. > > Out of curiosity, does MSVC define __STDC_VERSION__, and if so, to what?
It does not. While it does support a subset of C99's features, it doesn't support the entirety of that language so defining __STDC_VERSION__ would be inaccurate and misleading.
Show 17 quoted lines
> >>> And obviously before releasing this or anything similar, it would be >>> nice to see results from people building pu. I'm especially curious >>> whether MSVC would work with this (or if people even still use it, since >>> Git for Windows is pretty mature?). >> >> We do use MSVC internally as that gives us access to the great debuggers and >> profilers on the Windows platform. Fortunately, this particular C99 >> construct _is_ supported by MSVC. I applied the patch below and complied it >> with both MSVC and gcc for Windows and both builds succeeded. > > Thanks. This kind of prompt testing and response is very appreciated. It > is unfortunate if we have to pick and choose C99-isms rather than using > the whole thing as a base. But that's probably just reality. > > -Peff >