Warning statement with no effect.

Posted by Robert Powell on Sat 12 Mar 2005 06:38 AM — 3 posts, 16,168 views.

Australia #0
After un-remarking the Wflags in my makefile(dont know who did that(or should that be when)) i found i had a multitude of warnings for differing things.

Most of these were just silly re-declerations and unused variables and a nifty little one i found in sscanf where it needed a %lu to like the long ints that were being thrown at it. Babbling yes, getting to the point, Now.

I have cleaned out all but one warning and thats this line of code in comm.c in nanny

(d);

Which just so happens to return Warning statement with no effect. I dont know how to remove this warning or what the cause is, tho im about to look it up on the net and find out more about this warning.

Any help in rectifying and or an explanation about this warning would be great.

Thanks in advance,
USA #1
The cause is quite simple. It means just what it says: you (or whoever) entered a statement that has no effect. It's like typing:

int i = 2;
i; // statement with no effect

The way to fix this is to simply get rid of the statement. Make sure the statement has no side-effects before doing that. (But chances are, if gcc reported it as having no side-effects, it has no side-effects.) If d is just a variable defined in a function, you should be fine.
Australia #2
Somehow along the way, the call to show_title was removed and all that remained was (d);, dont know how this happened at all. I think its time i learned how to use cvs and track all the changes that i make, and to never remark things out of the makefile.