[lkml]   [2001]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [IDEA+RFC] Possible solution for min()/max() war
    On August 28, 2001 05:14 pm, Linus Torvalds wrote:
    > I'll show you a real example from drivers/acorn/scsi/acornscsi.c:
    > min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
    > this_residual is "int", and "DMAC_BUFFER_SIZE" is just a #define for
    > an integer constant. So the above is actually a signed comparison, and
    > I'll bet you that was not what the author intended.
    > Now, this_residual is hopefully never negative, so it doesn't matter.

    min(host->scsi.SCp.this_residual, (unsigned) DMAC_BUFFER_SIZE / 2);

    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:17    [W:0.020 / U:159.312 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site