[lkml]   [2001]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [IDEA+RFC] Possible solution for min()/max() war
    Roman Zippel wrote:
    > > 3. Warning added to GCC for signed vs. unsigned comparisons
    > > _regardless_ of type size. This would also catch erroneous
    > > unsigned char vs. EOF checks in misuses of stdio.
    > Do you know of such bug in the context of min()?

    I don't know of an actual example. This one is made up:

    min (int, len, big_size)

    Now if big_size has unsigned type, and does not fit in the range of int,
    this expression will return the value of big_size cast to int, i.e. a
    negative value. The suggested warning would catch this potential bug.

    I don't know if it would warn for too many other things. Certainly, a
    sizeof() exception (don't warn about signed comparison with sizeof()
    result) is essential; perhaps too many other exceptions are required

    -- Jamie
    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.022 / U:390.520 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site