|
By Marshall,
If there's a problem we solve it, if we don't resolve it
It usually just evolves into one big brawl
And we all get involved in it Kind of like what our attitude toward a warning should be, before it becomes an error; logical or otherwise.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
And me:
Quote: Bob the Coder
Can we fix it?
Bob the Coder
Yes, we can!
Time to get busy, such a lot to do
Building and fixing till it's good as new
Bob and the gang have so much fun
Working together, they get the App done
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
So I have to work out why.
Warnings are important - they generally mean you made a mistake that could affect you later when you have forgotten all about it.
Fix 'em all.
Yes, it does annoy me when I get errors like:
CS1591 "Missing XML comment for publicly visible type or member ..." and
CS0219 "The variable 'x' is assigned but its value is never used" But not as much as having to revisit code to add XML documentation later when I've forgotten it, or find I used the wrong variable in debugging ...
Generally, compiler warnings these days are sensible: ignore them at your peril! And certainly, if you are a beginner, warnings indicate you did make a big mistake and have to be looked at before you run your code.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm now scared of you. Terrified, to be more precise.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
I bet (s)he ignores unit test failures as well.
|
|
|
|
|
They might actually work for one of our outsourcing partners … they don't seem to bother to do any sort of testing at all!
|
|
|
|
|
The answers are unsuitable, each and every one.
I don't have a team to spoil my fun.
I fix what I can fix - but sometimes it becomes the job of a try-catch (somewhere between ignoring and not ignoring).
Maybe a new committee for CP: Weekly Survey Vetting Mob.
Admittedly it may reduce the number of complaints about the available answers and checkbox vs radio button controls - but somehow we'd manage.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
What (s)he said. Very often the answers are difficult to choose from because some "common sense" answers are not there(not that I'm knocking anyones common sense, it's just that this weeks is a case in point, it should have had a "fix errors and as many warnings as possible" answer).
|
|
|
|
|
Ok it's a niche product
but a couple of warnings can not be fixed as
they come from the internal datamodel delivered with the product.
In some other cases, there is symply no way to provide a "warning free" code.
So I am in the terrible QA situation that I have to know that for a specific component
10 warnings are OK, but when I see 11, I have to look into it.
|
|
|
|
|
Maybe you could use...
#pragma warning disable IDE0060 // Remove unused parameter
#pragma warning restore IDE0060 // Remove unused parameter That works in C# at least, I'm guessing your language (if not C#) has something similar.
|
|
|
|
|
C++ does the same, same pragma directives plus a couple cool ones (#pragma push and #pragma pop ).
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
But with the current code base that I have inherited it makes spaghetti code seem more inviting, so I picked "Depends on the codebase and my level of enthusiasm"
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I fix messages, warnings and errors.
If someone else checked them in on an otherwise clean solution I'll talk to them about it and (hopefully) get it fixed.
When there's an existing solution with many warnings already I can't be bothered, or when the team obviously doesn't care about them and it seems to be a lost battle.
I don't get it though.
Here's your compiler telling you your software may have issues.
Why don't you just fix it and keep your code clean
|
|
|
|
|
I fix all the warnings, only in some cases I #pragma them away (when I used VS6 there were warnings of Templates exceending 255 chars in the STL, how am I supposed to fix them?).
First, warnings are pollution. When everything is all right I want to see only a line telling me that compilation went ok.
Second, warnings are pollution. Even if the warnings/errors window makes it easy to separate them, I always watch the compilation output when compiling. I want to spot errors ASAP.
Third, warnings are not useless. Some may be but more often than not they are faults lying in ambush.
Fourth, if you give me some code that produces 10+ warnings I assume you gave me permission to track you down, hunt you and terminate you with extreme prejudice.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Quote: Fourth, if you give me some code that produces 10+ warnings I assume you gave me permission to track you down, hunt you and terminate you with extreme prejudice.
I really like this!
I couldn't have said this in any better way!
|
|
|
|
|
Ditto!
Although I once left a comment in some code along the lines of …
|
|
|
|
|
I like that too.
I tend to avoid any warning in my code (though I have de-activated a few, such as the 255 mentioned above). But my co-worker are not so single-minded and I have to remind them on occasions. May be if I had the right to terminate them that could change things!
|
|
|
|
|
...at the results of the poll so far.. I honestly expected option 1 to be the clear leader.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
Today's warning is tomorrow's undetectable run-time issue. Even if I am working on a one-time project I will always try and fix warnings in case I reuse that section of code.
...and also because I can't leave them, it annoys me.
|
|
|
|
|
Programmers and OCD are buddies since the beginning of time.
GCS d--(d+) s-/++ a C++++ U+++ P- L+@ E-- W++ N+ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t+ 5? X R+++ tv-- b+(+++) DI+++ D++ G e++ h--- r+++ y+++* Weapons extension: ma- k++ F+2 X
|
|
|
|
|
Yes, here you are, you knights of code, fighting for the holy grail.
In real life we got to continue an existing project last year.
There were more than 70.000 warnings, not to mention about the same number of messages, part of them critical (!) of the static code analysis.
So, at least, they don't lie in the poll. Thank you.
|
|
|
|
|
Depends what you are working on but that wasn't an answer in the survey
Leaving aside the quirks of C++ compilers (which I try never to touch) you should assess every warning and either fix it or handle it. Handling it doesn't mean ignoring it, it means handling it properly. This is however a general rule and if your code works with 70000 warnings it might be more sensible leaving them in so you are reminded to revisit them on a wet day without much else on and find out why.
|
|
|
|
|
You are absolutely right.
Warnings are useful to help you create better code - and I always try to understand the reason and to fix it properly.
But I have seen so many old, grown projects, with big lists of warnings, so I would never expect option 1 on position one.
|
|
|
|
|
I once fixed around 300 warnings in a code base that I inherited. It turned out to be the wrong approach because it broke the code. I did not have the time to figure out why so, I just said <blank it=""> an ignored them.
To this day I still wish I had had the time to find why fixing the code broke the code.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence." - Edsger Dijkstra
"I have never been lost, but I will admit to being confused for several weeks. " - Daniel Boone
|
|
|
|