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. How many bugs out there?

How many bugs out there?

Scheduled Pinned Locked Moved The Lounge
questionc++collaborationhelpannouncement
21 Posts 17 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.
  • _ _fboy_

    Well, this is my first post. I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it. A lame coder like me wants a clean(no warnings at all, even in C++) code, but a Microsoft team probably ignored warnings. You know warnings are there to warn coders against potential bugs. Well, they must have pretty much warnings so they ignored that. OK, my question comes: How many warnings, do you think, Windows source code gives when compiling? And please specify the version ;) Oh, my bet: Vista, compiling on a 32-bit machine, warning count causes an integer overflow :P Have a good day!

    D Offline
    D Offline
    Dave Parker
    wrote on last edited by
    #4

    A lot, but doesn't VC++, at least by default, give an error if a certain number of warnings are exceeded and then doesn't bother continuing with the compilation? But I guess if you took the separate projects etc and added them up it'd be a lot ;) Back in C/C++ I used to always ensure I resolved all warnings though in the C#/.NET world I tend to ignore some of them. Things like a small private method not having an xml summary comment I don't think are too important, plus I occasionally disable the unreachable code warning for a section of code when using conditional compilation.

    M 1 Reply Last reply
    0
    • _ _fboy_

      Well, this is my first post. I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it. A lame coder like me wants a clean(no warnings at all, even in C++) code, but a Microsoft team probably ignored warnings. You know warnings are there to warn coders against potential bugs. Well, they must have pretty much warnings so they ignored that. OK, my question comes: How many warnings, do you think, Windows source code gives when compiling? And please specify the version ;) Oh, my bet: Vista, compiling on a 32-bit machine, warning count causes an integer overflow :P Have a good day!

      E Offline
      E Offline
      Electron Shepherd
      wrote on last edited by
      #5

      _fboy_ wrote:

      I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it.

      It wasn't a forgotten & - it was an extra one. Instead of passing a pointer, they passed the address of a pointer. Depending on function declarations, a compiler may not spot this, for the simple reason the types are the same. Passing the address of a pointer is fairly common in COM (see QueryInterface[^] for an example.

      Server and Network Monitoring

      A P 2 Replies Last reply
      0
      • _ _fboy_

        Well, this is my first post. I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it. A lame coder like me wants a clean(no warnings at all, even in C++) code, but a Microsoft team probably ignored warnings. You know warnings are there to warn coders against potential bugs. Well, they must have pretty much warnings so they ignored that. OK, my question comes: How many warnings, do you think, Windows source code gives when compiling? And please specify the version ;) Oh, my bet: Vista, compiling on a 32-bit machine, warning count causes an integer overflow :P Have a good day!

        R Offline
        R Offline
        Rama Krishna Vavilala
        wrote on last edited by
        #6

        In windows 7 source code there are exactly 42 warnings.

        H 1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          In windows 7 source code there are exactly 42 warnings.

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #7

          Yes and it took M$ 75 Million Years to find them!

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

          1 Reply Last reply
          0
          • _ _fboy_

            Well, this is my first post. I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it. A lame coder like me wants a clean(no warnings at all, even in C++) code, but a Microsoft team probably ignored warnings. You know warnings are there to warn coders against potential bugs. Well, they must have pretty much warnings so they ignored that. OK, my question comes: How many warnings, do you think, Windows source code gives when compiling? And please specify the version ;) Oh, my bet: Vista, compiling on a 32-bit machine, warning count causes an integer overflow :P Have a good day!

            R Offline
            R Offline
            Robert Surtees
            wrote on last edited by
            #8

            The build produces no warnings or errors. Special hooks are built into the OS to take care of this.

            1 Reply Last reply
            0
            • _ _fboy_

              Well, this is my first post. I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it. A lame coder like me wants a clean(no warnings at all, even in C++) code, but a Microsoft team probably ignored warnings. You know warnings are there to warn coders against potential bugs. Well, they must have pretty much warnings so they ignored that. OK, my question comes: How many warnings, do you think, Windows source code gives when compiling? And please specify the version ;) Oh, my bet: Vista, compiling on a 32-bit machine, warning count causes an integer overflow :P Have a good day!

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #9

              Hey, but it works on my machine.

              It is a crappy thing, but it's life -^ Carlo Pallini

              M 1 Reply Last reply
              0
              • D Dave Parker

                A lot, but doesn't VC++, at least by default, give an error if a certain number of warnings are exceeded and then doesn't bother continuing with the compilation? But I guess if you took the separate projects etc and added them up it'd be a lot ;) Back in C/C++ I used to always ensure I resolved all warnings though in the C#/.NET world I tend to ignore some of them. Things like a small private method not having an xml summary comment I don't think are too important, plus I occasionally disable the unreachable code warning for a section of code when using conditional compilation.

                M Offline
                M Offline
                Mike Marynowski
                wrote on last edited by
                #10

                Why would you get unreachable code with conditional compilation? You shouldn't if you do it "right":

                void Function()
                {

                // do stuff

                #if SILVERLIGHT

                // do stuff

                return;

                #else

                // do other stuff

                return;

                #endif

                }

                If you have unreachable code, just put it in an else block. I can't think of a situation where this doesn't work.

                D 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  Hey, but it works on my machine.

                  It is a crappy thing, but it's life -^ Carlo Pallini

                  M Offline
                  M Offline
                  Mark_Wallace
                  wrote on last edited by
                  #11

                  Rajesh R Subramanian wrote:

                  Hey, but it works on my machine.

                  Put that Mac down!

                  I wanna be a eunuchs developer! Pass me a bread knife!

                  K 1 Reply Last reply
                  0
                  • _ _fboy_

                    Well, this is my first post. I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it. A lame coder like me wants a clean(no warnings at all, even in C++) code, but a Microsoft team probably ignored warnings. You know warnings are there to warn coders against potential bugs. Well, they must have pretty much warnings so they ignored that. OK, my question comes: How many warnings, do you think, Windows source code gives when compiling? And please specify the version ;) Oh, my bet: Vista, compiling on a 32-bit machine, warning count causes an integer overflow :P Have a good day!

                    R Offline
                    R Offline
                    Revo Linno
                    wrote on last edited by
                    #12

                    Could someone post also a link about this Microsoft bug? TIA

                    1 Reply Last reply
                    0
                    • M Mark_Wallace

                      Rajesh R Subramanian wrote:

                      Hey, but it works on my machine.

                      Put that Mac down!

                      I wanna be a eunuchs developer! Pass me a bread knife!

                      K Offline
                      K Offline
                      Kasterborus
                      wrote on last edited by
                      #13

                      Mark Wallace wrote:

                      Rajesh R Subramanian wrote: Hey, but it works on my machine. Put that Mac down!

                      Concur! -GateHawk

                      1 Reply Last reply
                      0
                      • E Electron Shepherd

                        _fboy_ wrote:

                        I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it.

                        It wasn't a forgotten & - it was an extra one. Instead of passing a pointer, they passed the address of a pointer. Depending on function declarations, a compiler may not spot this, for the simple reason the types are the same. Passing the address of a pointer is fairly common in COM (see QueryInterface[^] for an example.

                        Server and Network Monitoring

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

                        It depends on the signature of the function being called. If the pointer was LPVOID (for example) that may be the case, but if the pointer was to a concrete type (e.g. int) the & and && forms have different types, which the compiler should catch. Even if the compiler missed it I'd expect any of the major static analysis tools would be able to identify such an error.

                        Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                        E P 2 Replies Last reply
                        0
                        • M Mike Marynowski

                          Why would you get unreachable code with conditional compilation? You shouldn't if you do it "right":

                          void Function()
                          {

                          // do stuff

                          #if SILVERLIGHT

                          // do stuff

                          return;

                          #else

                          // do other stuff

                          return;

                          #endif

                          }

                          If you have unreachable code, just put it in an else block. I can't think of a situation where this doesn't work.

                          D Offline
                          D Offline
                          Dave Parker
                          wrote on last edited by
                          #15

                          My bad - I wasn't thinking straight. The unreachable code warnings I encounter are mostly when I'm making a temporary change just to test something rather than conditional compilation. It can be an issue when using a constant flag to determine which path to take rather than a config setting or conditional compilation symbol, though I guess that is the wrong use of a const.

                          1 Reply Last reply
                          0
                          • A Anna Jayne Metcalfe

                            It depends on the signature of the function being called. If the pointer was LPVOID (for example) that may be the case, but if the pointer was to a concrete type (e.g. int) the & and && forms have different types, which the compiler should catch. Even if the compiler missed it I'd expect any of the major static analysis tools would be able to identify such an error.

                            Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                            E Offline
                            E Offline
                            Electron Shepherd
                            wrote on last edited by
                            #16

                            Maybe. A quick Google failed to turn up the offending source code. Have you seen the actual problem lines? It would be interesting to pass it through Lint (or a more "visual" version of it :-D )

                            Server and Network Monitoring

                            A 1 Reply Last reply
                            0
                            • A Anna Jayne Metcalfe

                              It depends on the signature of the function being called. If the pointer was LPVOID (for example) that may be the case, but if the pointer was to a concrete type (e.g. int) the & and && forms have different types, which the compiler should catch. Even if the compiler missed it I'd expect any of the major static analysis tools would be able to identify such an error.

                              Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                              P Offline
                              P Offline
                              Pete OHanlon
                              wrote on last edited by
                              #17

                              Anna-Jayne Metcalfe wrote:

                              Even if the compiler missed it I'd expect any of the major static analysis tools would be able to identify such an error.

                              Yeah - and what would you know about static analysis tools anyway? ;P

                              "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                              As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                              My blog | My articles | MoXAML PowerToys | Onyx

                              A J 2 Replies Last reply
                              0
                              • E Electron Shepherd

                                Maybe. A quick Google failed to turn up the offending source code. Have you seen the actual problem lines? It would be interesting to pass it through Lint (or a more "visual" version of it :-D )

                                Server and Network Monitoring

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

                                I must admit I haven't - I'm just going on what I've learnt from experience. I could try it easily enough given the code - the value tracking in PC-lint 9.0 is pretty good, so even if it's an LPVOID there's a good chance it will spot it. I can't speak for PreFAST (which MS use internally), though when I've run that on some of our reference codebases it's missed some pretty basic stuff.

                                Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                                1 Reply Last reply
                                0
                                • P Pete OHanlon

                                  Anna-Jayne Metcalfe wrote:

                                  Even if the compiler missed it I'd expect any of the major static analysis tools would be able to identify such an error.

                                  Yeah - and what would you know about static analysis tools anyway? ;P

                                  "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                  As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                  My blog | My articles | MoXAML PowerToys | Onyx

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

                                  Pete O'Hanlon wrote:

                                  Yeah - and what would you know about static analysis tools anyway?

                                  Guilty as charged! :-O Just for a change I'm knee-deep in refactoring at the moment. Boy is it fun... :doh:

                                  Anna :rose: Having a bad bug day? Tech Blog | Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                                  1 Reply Last reply
                                  0
                                  • P Pete OHanlon

                                    Anna-Jayne Metcalfe wrote:

                                    Even if the compiler missed it I'd expect any of the major static analysis tools would be able to identify such an error.

                                    Yeah - and what would you know about static analysis tools anyway? ;P

                                    "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                    As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                    My blog | My articles | MoXAML PowerToys | Onyx

                                    J Offline
                                    J Offline
                                    James Lonero
                                    wrote on last edited by
                                    #20

                                    Ouch! Pete, that was harsh.

                                    1 Reply Last reply
                                    0
                                    • E Electron Shepherd

                                      _fboy_ wrote:

                                      I was thinking about the Windows bug caused by a forgotten "&". It made me think that the compiler would raise a warning in a such situation. So, they must have ignored it.

                                      It wasn't a forgotten & - it was an extra one. Instead of passing a pointer, they passed the address of a pointer. Depending on function declarations, a compiler may not spot this, for the simple reason the types are the same. Passing the address of a pointer is fairly common in COM (see QueryInterface[^] for an example.

                                      Server and Network Monitoring

                                      P Offline
                                      P Offline
                                      Plamen Dragiyski
                                      wrote on last edited by
                                      #21

                                      And I wonder how can you trust an interface called IUnknown? :laugh:

                                      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