What warning level do you build at?
-
We use the
UNREFERENCED_PARAMETER
macro - as invoid function(int value) { ... code that doesn't use the value UNREFERENCED_PARAMETER(value) }
It makes it clear that someone has thought about the parameter and its (lack of) use.
We do the same thing, except ours is called
Unused(_parameter_);
. We started using it before we knew aboutUNREFERENCED_PARAMETER
.
Software Zen:
delete this;
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
start -
Debug builds level 4 Release builds level 4 with warning as errors.
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
startDefault warning level. No way I could treat warnings as errors - most of the warnings come from the libraries I use.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
startNitron wrote: What warning level do you usually build at, and do you treat warnings as errors? Highest possible warning level. Warnings as errors for release builds. Nitron wrote: Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) No. Clear, well-written code shouldn't produce any. The only ones I allow are in third-party code (and I usually #pragma them out).
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
- Level 4 (I changed the project template VS uses so that you don't have to remember to change it each time) - Warnings as errors on Release Build - DevPartner Profiler Community Edition (Free) - don't have a "good" memory checker anymore, so I just add a little code to the CMyApp class destructor that will dump warnings if a memory leak is detected. The majority of warnings I ignore are the ones produced by third party code. (STL) I usually suppress those with pragma statements. Other than that I try and eliminate as many warnings as possible. I think the only warning I've ignored recently is: while(1) // do whatever, break when necessary This generates a C4127 "conditional expression is constant" warning. Like others, I also use the UNREFERENCED_PARAMETER macro for unused params warnings.
Pssst. You see that little light on your monitor? That's actually a spy camera, and I'm tracking your every move...
Jack Rabbit wrote: while(1) // do whatever, break when necessary Yeh, I replaced my while(true) with for ( ; ; ) to fix this warning! ;)
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
startIt depends. If it's a VC7 or later project - Warning level 4 and warnings to errors. If it's a VC6 project that doesn't use STL - Warning level 4 and warnings to errors. If it's a VC6 project that uses STL - Warning level 3 and #pragma to disable warning 4786 Indeed it's the incredibly high number of warnings that STL causes in VC6 that held me off for so long on using STL. I'm very much of the school of thought that warnings from the compiler should be heeded. Rob Manderson I'm working on a version for Visual Lisp++ My (occasional) blog http://blogs.wdevs.com/ultramaroon/[^]
-
It depends. If it's a VC7 or later project - Warning level 4 and warnings to errors. If it's a VC6 project that doesn't use STL - Warning level 4 and warnings to errors. If it's a VC6 project that uses STL - Warning level 3 and #pragma to disable warning 4786 Indeed it's the incredibly high number of warnings that STL causes in VC6 that held me off for so long on using STL. I'm very much of the school of thought that warnings from the compiler should be heeded. Rob Manderson I'm working on a version for Visual Lisp++ My (occasional) blog http://blogs.wdevs.com/ultramaroon/[^]
Rob Manderson wrote: Indeed it's the incredibly high number of warnings that STL causes in VC6 that held me off for so long on using STL. I'm very much of the school of thought that warnings from the compiler should be heeded. Me too. It's a real relief to me that the STL shipped with VS.NET is free from that particular problem. The STL documentation is still pretty crappy, though! :sigh: Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
-
Default warning level. All warnings are eliminated. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. Are you bright too?[^]
Jörgen Sigvardsson wrote: All warnings are eliminated. Ah, but do you assimilate them first? :~ Anna :rose: Riverblade Ltd - Software Consultancy Services Anna's Place | Tears and Laughter "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work.
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
startWarning level 4. I don't treat warnings as errors but I do make sure I get rid of them before releasing any code. I also use pc-lint to perform further checking. Mike
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
startYou really played Contra on Nintendo... Free your mind...
-
Nitron wrote: What warning level do you usually build at, and do you treat warnings as errors? Highest possible warning level. Warnings as errors for release builds. Nitron wrote: Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) No. Clear, well-written code shouldn't produce any. The only ones I allow are in third-party code (and I usually #pragma them out).
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
You really played Contra on Nintendo... Free your mind...
-
What warning level do you usually build at, and do you treat warnings as errors? Are there any warnings you feel you can safely ignore (Like unreferenced formal paramater?) Opinions / Comments? On a side note, do any of you use a code profiler or external code checker to enforce custom coding standards? ~Nitron.
ññòòïðïðB A
startIn gcc: (this was compililng C code) -W -Wall -ansi -pedantic -Wbad-function-cast -Wcast-align -Wcast-qual -Wchar-subscripts -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings Which is basicly all warnings it can produce. The code isn't done until all warnings are eliminated. If there is any choice that is eliminated, not turned off. They are called warnings for a reason: you are likely to be bitten by doing that. I don't treat warnings as errors, but if anyone checks in code with warnings it gets written up as a bug right away, and must be closed before we ship. When doing a quick test to see if the bug is where I think it is warnings are ok. I suppose if I ever had problems with libraries or STL I'd have to change something. Preferably the library though. There is no excuse for shipping a library that causes warnings! Still, sometimes there is no other good choice so I'd accept turning off some warnings if required in some cases. I'm amazed that some of you claim to use default warning levels. True the most common problems are in the default level. True there is a reason some warnings are not in the default level. However you should still compile with the highest level, and if you can't eliminate some warning you should at least understand what the compiler is warning about, and write something up so the rest of us know why it isn't a problem.
-
Whatever warning level we build at, we get flooded with warnings because we've not added XML comments to all class declarations and constructors. We cannot get rid of these warnings without turning off generation of documentation from the XML comments. And THEN the compiler seems to show all warnings/errors in an arbitrary order, and certainly does not put errors at the top, or any other position in particular. So when there's an error, it's faster to search for the word 'error' on the build pane than it is to slide the list of warnings up and down looking for the exclamation marks. It's a joke, I hate it. Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
Thats what the /nowarn option is for! its only a couple, so add then and build happier :p top secret
Download xacc-ide 0.0.3 now!
See some screenshots -
Ryan Binns wrote: No. Clear, well-written code shouldn't produce any. The only ones I allow are in third-party code (and I usually #pragma them out). so does this include the STL? ~Nitron.
ññòòïðïðB A
startNitron wrote: so does this include the STL? I rarely use it because of the warnings. If I do, I disable the ones the STL produces. IMO, the STL (well, the MS implementation anyway) is not a well-written piece of code; I still maintain that well-written code should not produce any warnings.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Nitron wrote: so does this include the STL? I rarely use it because of the warnings. If I do, I disable the ones the STL produces. IMO, the STL (well, the MS implementation anyway) is not a well-written piece of code; I still maintain that well-written code should not produce any warnings.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"