lkml.org 
[lkml]   [2003]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] only use 48-bit lba when necessary

    >> The operands of & can be evaluated in any order, while && requires
    >> left-to-right and does not evaluate the right operand if the left one
    >> is false. Only the simplest cases could possibly generate the same
    >> code.
    >
    > The code must execute AS IF the right operand is only evaluated if the left
    > operand is true.
    >
    > If an optimizer can prove that evaluating an operand has no side effects
    > (which a halfway-decent optimizer can usually do for simple expressions),
    > then it is free to evaluate it in any way that will produce the same
    > result.


    No, that's not quite right. Take this code for example:

    struct foo *bar;

    if (bar && bar->baz == 6) /* something */;

    If bar were zero, then evaluating the right side of the && would cause
    a fault. (This is not a side effect.)

    So the AS IF part if your statement is right but you have to consider
    more than just side effects.

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

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