From: Jonathan Nieder Date: Mon, 07 Nov 2011 22:21:09 GMT Subject: Re: [PATCH 3/3] grep: get rid of useless x < 0 comparison on an enum member Message-ID: <20111107222109.GA22693@elie.hsd1.il.comcast.net> In-Reply-To: <7vd3d31u4e.fsf@alter.siamese.dyndns.org> Junio C Hamano wrote: > 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. No, automatic static analyzers will not help you avoid using an uninitialized enum value here (well, I guess they could, but I don't believe gcc or clang is nearly smart enough for that). The only replacement for the check is (1) humans and (2) valgrind. In this particular case, as you mentioned before, (1) seems to be quite sufficient.