Re: [PATCH] grep: remove tautological check

2012-10-22 Thread Peter Krefting
David Soria Parra: - if (p-field 0 || GREP_HEADER_FIELD_MAX = p-field) + if (GREP_HEADER_FIELD_MAX = p-field) A friend taught me this trick, which will check that it isn't negative for compilers that have the enumeration be signed (notably MSVC), while not

Re: [PATCH] grep: remove tautological check

2012-10-20 Thread Peter Krefting
David Soria Parra: The enum grep_header_field is unsigned. Enumerations can be either unsigned or signed, it is up to the compiler to decide. Even if you assign only positive number to named enumeration values, there are compilers that make them signed. I've been bitten by that enough.