Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. What warning level do you build at?

What warning level do you build at?

Scheduled Pinned Locked Moved The Lounge
questiondiscussion
30 Posts 20 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nitron

    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

    J Offline
    J Offline
    Jorgen Sigvardsson
    wrote on last edited by
    #8

    Default warning level. All warnings are eliminated. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. Are you bright too?[^]

    A 1 Reply Last reply
    0
    • G Gary R Wheeler

      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;

      G Offline
      G Offline
      Graham Bradshaw
      wrote on last edited by
      #9

      We use the UNREFERENCED_PARAMETER macro - as in

      void 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.

      G 1 Reply Last reply
      0
      • C Christian Graus

        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

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #10

        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

        1 Reply Last reply
        0
        • N Nitron

          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

          J Offline
          J Offline
          J Dunlap
          wrote on last edited by
          #11

          Default warning level, but I eliminate all warnings before release.

          "A people that values its privileges above its principles soon loses both."
          -- Dwight D. Eisenhower

          1 Reply Last reply
          0
          • N Nitron

            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

            R Offline
            R Offline
            Ray Cassick
            wrote on last edited by
            #12

            I 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.


            1 Reply Last reply
            0
            • N Nitron

              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

              J Offline
              J Offline
              Jack Puppy
              wrote on last edited by
              #13

              - 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...

              L 1 Reply Last reply
              0
              • G Graham Bradshaw

                We use the UNREFERENCED_PARAMETER macro - as in

                void 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.

                G Offline
                G Offline
                Gary R Wheeler
                wrote on last edited by
                #14

                We do the same thing, except ours is called Unused(_parameter_);. We started using it before we knew about UNREFERENCED_PARAMETER.


                Software Zen: delete this;

                1 Reply Last reply
                0
                • N Nitron

                  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

                  Y Offline
                  Y Offline
                  Yulianto
                  wrote on last edited by
                  #15

                  Default level, often the warning is not that important


                  Work hard and a bit of luck is the key to success.

                  You don`t need to be genius, to be rich.

                  1 Reply Last reply
                  0
                  • G Graham Bradshaw

                    Debug builds level 4 Release builds level 4 with warning as errors.

                    N Offline
                    N Offline
                    Nitron
                    wrote on last edited by
                    #16

                    Graham Bradshaw wrote: Debug builds level 4 Release builds level 4 with warning as errors. wow, you said that pretty sternly. Are you using STL at all, or purely MFC (or win32). ~Nitron.


                    ññòòïðïðB A
                    start

                    1 Reply Last reply
                    0
                    • N Nitron

                      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

                      N Offline
                      N Offline
                      Nemanja Trifunovic
                      wrote on last edited by
                      #17

                      Default 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.

                      1 Reply Last reply
                      0
                      • N Nitron

                        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

                        R Offline
                        R Offline
                        Ryan Binns
                        wrote on last edited by
                        #18

                        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"

                        N 1 Reply Last reply
                        0
                        • J Jack Puppy

                          - 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...

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #19

                          Jack Rabbit wrote: while(1) // do whatever, break when necessary Yeh, I replaced my while(true) with for ( ; ; ) to fix this warning! ;)


                          The Rob Blog

                          1 Reply Last reply
                          0
                          • N Nitron

                            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

                            R Offline
                            R Offline
                            Rob Manderson
                            wrote on last edited by
                            #20

                            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/[^]

                            A 1 Reply Last reply
                            0
                            • R Rob Manderson

                              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/[^]

                              A Offline
                              A Offline
                              Anna Jayne Metcalfe
                              wrote on last edited by
                              #21

                              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.

                              1 Reply Last reply
                              0
                              • J Jorgen Sigvardsson

                                Default warning level. All warnings are eliminated. -- Weiter, weiter, ins verderben. Wir müssen leben bis wir sterben. Are you bright too?[^]

                                A Offline
                                A Offline
                                Anna Jayne Metcalfe
                                wrote on last edited by
                                #22

                                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.

                                1 Reply Last reply
                                0
                                • N Nitron

                                  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

                                  M Offline
                                  M Offline
                                  Mike Beckerleg
                                  wrote on last edited by
                                  #23

                                  Warning 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

                                  1 Reply Last reply
                                  0
                                  • N Nitron

                                    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

                                    G Offline
                                    G Offline
                                    Guillermo Rivero
                                    wrote on last edited by
                                    #24

                                    You really played Contra on Nintendo... Free your mind...

                                    N 1 Reply Last reply
                                    0
                                    • R Ryan Binns

                                      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"

                                      N Offline
                                      N Offline
                                      Nitron
                                      wrote on last edited by
                                      #25

                                      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
                                      start

                                      R 1 Reply Last reply
                                      0
                                      • G Guillermo Rivero

                                        You really played Contra on Nintendo... Free your mind...

                                        N Offline
                                        N Offline
                                        Nitron
                                        wrote on last edited by
                                        #26

                                        Guillermo Rivero wrote: You really played Contra on Nintendo... Absolutely! ~Nitron.


                                        ññòòïðïðB A
                                        start

                                        1 Reply Last reply
                                        0
                                        • N Nitron

                                          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

                                          H Offline
                                          H Offline
                                          Henry miller
                                          wrote on last edited by
                                          #27

                                          In 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.

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups