What warning level do you build at?
-
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
startDebug 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. All warnings are eliminated. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. Are you bright too?[^]
-
Level 4. We don't treat warnings as errors, though. As a rule, we try to code such that benign warnings aren't issued in the first place. Using your example, the 'unreferenced formal parameter' warning can be suppressed by commenting out the parameter name:
void function(int /*parameter*/);
or you can do the following:
void function(int parameter);
{
parameter;
}The
parameter;
statement doesn't do anything, but it is a sufficient reference to suppress the warning. In very select places, we use#pragma warning(push)
#pragma warning(disable:NNNN)
//...
#pragma warning(pop)to suppress a specific warning in a block of code. We don't use any specific tools to enforce coding standards. Peer review is sufficient in our shop, since we tend to step into each other's code fairly often. Our standards are deliberately loose. We specify a naming style/convention, and that's about it.
Software Zen:
delete this;
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.
-
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
Are you talking about the task pane in VS.NET? You can click the column headers to display errors at top. (i still prefer working off the compiler output though, glad VS.NET2k3 fixed the default keyboard mapping)
How long was I dreaming for What was it you wanted me for -
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 -
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
startI use FxCop for anything that I intend to distribute.
Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.
-
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- 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...
-
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...