|
My modis operandi is to treat warnings as errors. Warnings frequently become errors if ignored.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
Starting from scratch this is what I do. But most of the time I'm inheriting a team codebase and fixing them after the fact is usually not an option. It would need buy-in from the management. "Pause, fix all warnings and retest everything."
Of course, if these occur in an area of code I happen to be fixing or enhancing then it's another matter.
Kevin
|
|
|
|
|
Now the compiler won't complain anymore... :-P
|
|
|
|
|
Intel's Visual Studio compiler warnings and error messages are so vague that all you learn is that something is wrong. They are so miss leading that they cause you to go on a wild goose chase instead of finding a successful solution.
|
|
|
|
|
Member 13177847 wrote: Intel's Visual Studio
Try Microsoft VisualStudio instead.
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
|
|
|
|
|
There is no option that resembles "review all warnings and fix the ones that matter". I suspect that option would have gotten the largest chunk of the votes.
I chose "Fix all errors but generally ignore warnings" because it fit best.
|
|
|
|
|
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
|
|
|
|
|