Re: [PATCH 3/3] grep: get rid of useless x < 0 comparison on an enum member
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 7, 2011, 21:48 UTC
- Message-ID
- <7vd3d31u4e.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20111107213219.GA13537@elie.hsd1.il.comcast.net>
Jonathan Nieder <jrnieder@gmail.com> writes:
> So, the purpose of this patch was to work around this common bug in > static analyzers.
I fail to see how it could be even considered a work around.
If you do not use static analyzers, you do not have to do such a change, and the resulting code would (not the "negative" side, but the "positive" side) catch real bugs when somebody screwes up and stuffs a bogus oob value in p->field.
With the removal of the check, you _have_ to rely on static analyzers to do the _right thing_, but if you have static analyzers that do the right thing, you do not have to have such a workaround to begin with.