Web lists-archives.com

Re: [PATCH] strbuf: use designated initializers in STRBUF_INIT




Am 10.07.2017 um 09:03 schrieb Jeff King:
On Sun, Jul 09, 2017 at 10:05:49AM -0700, Junio C Hamano wrote:

René Scharfe <l.s.r@xxxxxx> writes:

I wonder when we can begin to target C99 in git's source, though. :)

Let's get the ball rolling...

Good to know that you do not resist moving to a more modern build environment.

by starting to use some of the useful
features like designated initializers,

It's a pity, though, that you do not suggest something even more useful, such as C++14.

Subject: [PATCH] strbuf: use designated initializers in STRBUF_INIT

-#define STRBUF_INIT  { 0, 0, strbuf_slopbuf }
+#define STRBUF_INIT  { .alloc = 0, .len = 0, .buf = strbuf_slopbuf }

While this may serve as a test balloon, changing STRBUF_INIT, or any of those _INIT macros, is actually the least interesting. The interesting instances are initializations for which we do *not* have a macro.

-- Hannes