[lkml]   [2008]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [Pull] Some documentation patches

    On Monday 2008-03-31 16:31, Dmitri Vorobiev wrote:
    >> @@ -107,8 +107,8 @@ complete. Here's the example version:
    >> static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
    >> {
    >> - loff_t *spos = (loff_t *) v;
    >> - *pos = ++(*spos);
    >> + loff_t *spos = v;
    >> + *pos = ++*spos;
    > Excuse me, what's the point in this change and the next one? IMO, removing
    > the explicit type cast makes the code less obvious.

    Why should it be less obvious? Exactly left to the (loff_t *) you
    already have loff_t *, so you know where you are going from v,
    whose type is also obviously visible right in the line above.
    Casts can hide errors. The cast is redundant, it does not
    cover up a compiler warning. Even so, casts can hide programming
    errors, as in .

    > Relying upon operator priorities instead of explicit
    > operator grouping using parentheses can confuse people, too.

    In case of *a++ I would agree -- you would need to know whether * or
    ++ has the higher precedence (hint: ++ has). But in ++*a it does not
    matter how much precedence either has, it always means the same.
    Just like an arithmetic expression "x*-5".
    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: 2008-04-01 22:03    [W:0.020 / U:149.872 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site