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 Offline
    N Offline
    Nitron
    wrote on last edited by
    #1

    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

    C A P G L 17 Replies 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 L 2 Replies 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

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

        I always use level 4. I used to use the "warnings as errors" option, but that got more and more impractical the more we used STL. PC-Lint is a more practical - and much more thorough alternative, although it does take some tuning and getting used to. Beth and I are working on that one, though! ;) 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

          P Offline
          P Offline
          pseudonym67
          wrote on last edited by
          #4

          I just build everything at the default level, but I wouldn't consider work on the code finished if it had a single warning. pseudonym67 My Articles[^] "They say there are strangers who threaten us, In our immigrants and infidels. They say there is strangeness too dangerous In our theaters and bookstore shelves. That those who know what's best for us Must rise and save us from ourselves." Rush

          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
            Gary R Wheeler
            wrote on last edited by
            #5

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

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

              I try to use level 4 for all projects, but some of my older code still uses level 3 (else I'd be fixing "unreferenced formal parameter" warnings till doomsday!). It is unacceptable for any of my projects to compile with a single warning. However, since I started using the STL, some warnings are unavoidable and have to be hacked out. A good example is release build warnings concerning debug code in <vector> so I hack it using something like:

              #pragma warning(push)
              #pragma warning(disable: 4702)
              #include <vector>
              #pragma warning(pop)

              I'm sure there will be more of this as I delve deeper into the STL (which has been an absolute joy to use so far - OK, it has its shortcomings, but boy is there some good stuff in there!).


              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

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

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

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