Re: sched.c

From: Peter T. Breuer (ptb@it.uc3m.es)
Date: Fri Jun 16 2000 - 08:27:05 EST


"A month of sundays ago Davide Libenzi wrote:"
[Charset iso-8859-1 unsupported, filtering to ASCII...]
>
> > I could understand the need for
> > if (weight > c)
> > c = weight, next = p;
> > It could as well have been
> > if (weight > c)
> > {
> > c = weight;
> > next = p;
> > }
> >
> > Since both compile to the same intermediate assembly code.
>
> Compactness - the more compact You write ( clarity provided ) the more
> information ( code )
> You can keep under Your sight without scrolling Your sources.

Yes, but in this case one has to know the relative precedences of comma
and equals to interpret the code right. It's about 30% probable that
someone who revise this code will not know it and will therefore revise
it badly. It was just as short to put:

  if (weight > c) { c = weight; next = p; }

if they were that concerned about code length. Come to that, they could
have done

   c = weight > c ? (next = p, weight) ; // or something else

Thus making use of a confusing gnu C extension :-).

Peter

-
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/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:11 EST