Marc, are you sure ? It means that the assignment gets evaluated as a boolean
expression??
-----Original Message-----
From: Marc Chametzky <marc at bluevine.net>
Sender: owner-hecnet at Update.UU.SE
Date: Thu, 07 Jun 2012 11:44:31
To: <hecnet at Update.UU.SE>
Reply-To: hecnet at Update.UU.SESubject: Re: [HECnet] New bridge.c feedback
1171 cc: WARNING File = bridge.c, Line = 684
The indicated expression has no effect.
if (port == 0) port == DPORT;
^
Apart from putting in a conditional?
DPORT is a constant that I intended for users that compile to be able
to change, if they want to.
By default is't zero, thus the compiler sees:
if (port == 0) port = 0;
No, that's not what the compiler is seeing. Instead, it's seeing this:
if (port == 0) 1;
That's because you have "port == DPORT" (a conditional, not an
assignment statement).
which is pretty meaningless, and thus something to warn about. But how
should I change the code to avoid that? I could (of course) add a
check to the if, but that makes it look more complicated, and silly.
Oh well, checking if DPORT have been defined to something non-zero is
a pretty reasonable solution I think.
--Marc