[HECnet] New bridge.c feedback

Marc Chametzky marc at bluevine.net
Thu Jun 7 16:44:31 PDT 2012


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



More information about the Hecnet-list mailing list