netdev
[Top] [All Lists]

Re: CodingStyle: while ((a=b))

To: Chris Wedgwood <cw@xxxxxxxx>
Subject: Re: CodingStyle: while ((a=b))
From: "chas williams (contractor)" <chas@xxxxxxxxxxxxxxxx>
Date: Sat, 26 Jun 2004 21:20:20 -0400
Cc: "David S. Miller" <davem@xxxxxxxxxx>, shemminger@xxxxxxxx, netdev@xxxxxxxxxxx, Linus Torvalds <torvalds@xxxxxxxx>
In-reply-to: Message from Chris Wedgwood <cw@xxxxxxxx> of "Sat, 26 Jun 2004 16:42:21 PDT." <20040626234221.GB12761@xxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
In message <20040626234221.GB12761@xxxxxxxxxxxxxxxxxxxxx>,Chris Wedgwood writes
:
>    while ((a=b)) to while ((a=b) != 0)

adding the != does not make the conditional clearer to me.  in fact
it just make it harder to read.  however, it probably not a good
idea to do assignments in places where someone might not expect to
see them.  the alternative something like this:

        while (1) {
                a = b;
                if (a == 0)
                        break;
        }

but its not very pretty either.

<Prev in Thread] Current Thread [Next in Thread>