[lkml]   [2001]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [IDEA+RFC] Possible solution for min()/max() war

    On Thu, 30 Aug 2001, Roman Zippel wrote:
    > So why won't you let the compiler help you, even if it's not perfect in
    > every case?

    I considered enabling -Wsign-compare a long time ago, and it's not a
    question of being "perfect", but a question of being _so_ broken that it's
    not funny.

    For example, let's look at this perfectly natural code:

    static int unix_mkname(struct sockaddr_un * sunaddr, int len, unsigned *hashp)
    if (len <= sizeof(short) || len > sizeof(*sunaddr))
    return -EINVAL;

    Would you agree that the above is _good_ code, and code that makes
    perfect sense, and code that does exactly the right thing in testing its

    Try to compile it with -Wsign-compare.

    You'll get not one, but TWO warnings for code that is totally correct, and
    that it would make _no_ sense in writing any other way.

    In short, -Wsign-compare (at least with a _lot_ of gcc versions) warns for
    totally sane and reasonable code - for code that exists all over the
    kernel. The above snippet is in fact directly from the kernel, go look and
    see for yourself.

    In short, -Wsign-compare is totally useless. The warnings are mostly _so_
    bogus that nobody has the energy to even try to figure out which of them
    might actually be worthwhile.

    Face it, you don't know what you're talking about.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:01    [W:0.048 / U:2.256 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site