Wouldn't an #ifndef DPORT statement solve that?
Hans
(And I'm an algol programmer, not very well versed in C magic ;-)
------Origineel bericht------
Van: Johnny Billquist
Afzender: owner-hecnet at Update.UU.SE
Aan: hecnet at Update.UU.SE
Beantwoorden: hecnet at Update.UU.SE
Onderwerp: Re: [HECnet] New bridge.c feedback
Verzonden: 7 juni 2012 17:18
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
Show replies by date