lkml.org 
[lkml]   [2000]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Kernel bugs found using inspect tool
    Peter T. Breuer wrote:
    > It would be even nicer if someone wrote
    >
    > aal5 = (vcc->qos.aal == ATM_AAL5);
    > if (!aal5) { ...

    Taking the assignment out of the if sounds like a good idea. Adding
    parentheses much less so. If people find C's precendence rules difficult
    to understand, it doesn't help to give them examples where precedence is
    enforced by redundant parentheses as if to suggest they were necessary,
    particularly if the intended meaning is obvious (which, I agree, may not
    be the case in the original code).

    > or even used a switch, since it's that kind of thing here.

    Not quite - the hardware doesn't know anything but AAL5 or non-AAL5.

    > Maybe it's just me, but this routine has if(aal5) all the way through,
    > and should probably be split into two.

    Then you'd also duplicate a lot of other, common, and quite hairy code.
    The driver is complex enough already ...

    - Werner

    --
    _________________________________________________________________________
    / Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch /
    /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

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