Re: [PATCH] mailinfo: resolve -Wstring-plus-int warning
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 22, 2014, 21:50 UTC
- Message-ID
- <CAPig+cS9oa+9U3RQgaQ6iTxO0QBOATSU4b426fwcpS2GFJWDpQ@mail.gmail.com>
- In-Reply-To
- <xmqqoau7js6a.fsf@gitster.dls.corp.google.com>
On Mon, Sep 22, 2014 at 4:50 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes: > >> however, the solution in this patch allows us drop a couple strlen()s in >> favor of sizeof()s. > > It is actually not a very good justification when you know you care > about the length of the string. A decent compiler ought to know the > length of a constant string can be computed at the compilation time.
Indeed, which is why I mentioned this only in the commentary rather than the commit message; but I was also thinking of some of the less-than-decent compilers with which git is sometimes built.
> Let's at least not do that part of the change.
I don't have strong feelings about it.