[HECnet] New bridge.c feedback

Johnny Billquist bqt at softjar.se
Thu Jun 7 16:18:38 PDT 2012


On 2012-06-07 16:32, Marc Chametzky wrote:

cc-1171 cc: WARNING File = bridge.c, Line = 684
The indicated expression has no effect.

if (port == 0) port == DPORT;
^

Blech! Well, DPORT is by default set to 0. See the documentation of
the define in the sources... This one will stay.
I saw your second message about putting this in a conditional, but out
of curiosity, why wouldn't you want to fix it? You don't have an
assignment statement here, so if you do define DPORT, it won't take
effect the way you want with the code like this.

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;

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.

	Johnny



More information about the Hecnet-list mailing list