Subject: Re: strbuf new API, take 2 for inclusion

From: Pierre Habouzit <[email-masked]>
Date: Thu, 06 Sep 2007 19:15:02 +0200

On Thu, Sep 06, 2007 at 12:58:11PM +0000, Jeff King wrote:
> On Thu, Sep 06, 2007 at 01:20:04PM +0200, Pierre Habouzit wrote:
> 
> >   I've also stripped as many STRBUF_INIT uses as possible, some people
> > didn't liked it. I've kept its use for "static" strbufs where it's way
> > more convenient that a function call.
> 
> The STRBUF_INIT initializer just sets everything to '0' or NULL. Static
> objects already have this done automagically by the compiler, so there's
> no need to use STRBUF_INIT at all there.

  Yes, Junio already did that remark. The reason is that it's forward
compatible: if we ever change strbuf's intitial value for some reason,
we would just have to rebuild the code. As junio disliked it (and I'm
not sure I love it either) I've used it where using the _init() function
was impractical.

  And yes { 0 } would have worked the same as per C standard. It's just
that I setup my compiler to flag missing C89 initializers (because it
often detects real errors).

  Here are the whys'

-- 
·O·  Pierre Habouzit
··O                                                [email-masked]
OOO                                                http://www.madism.org