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. OK repeat after me ...

OK repeat after me ...

Scheduled Pinned Locked Moved The Lounge
23 Posts 14 Posters 2 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.
  • M Monty2

    ... i will never ever write a base class without a virtual destructor :mad:


    I don't believe in failure. It is not failure if you enjoyed the process.

    A Offline
    A Offline
    Aryo Handono
    wrote on last edited by
    #5

    for(int i = 0;i < 100;i++) {   print("I will never ever write a base class without a virtual destructor."); } :-D:-D

    "Courage choose who will follow, Fate choose who will lead" - Lord Gunner, Septerra Core "Press any key to continue, where's the ANY key ?" - Homer Simpsons Drinking gives me amazing powers of insight. I can solve all the worlds problems when drunk, but can never remember the solutions in the morning. - Michael P Butler to Paul Watson on 12/08/03

    A 1 Reply Last reply
    0
    • R Roger Stoltz

      :laugh::laugh: How long did it take you to locate the error?


      "It's supposed to be hard, otherwise anybody could do it!" - selfquote

      "No one remembers a coward!" - Jan Elfström 1998
      "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #6

      Roger Stoltz wrote:

      How long did it take you to locate the error?

      Running in debug mode detected memory leaks (it was an abstract base class) and after a good solid hour or so of rearranging code it hit me to check and me the supreme coder havn't even added a destructor :mad:


      I can only please one person a day... today is not your day

      N 1 Reply Last reply
      0
      • M Monty2

        ... i will never ever write a base class without a virtual destructor :mad:


        I don't believe in failure. It is not failure if you enjoyed the process.

        N Offline
        N Offline
        NormDroid
        wrote on last edited by
        #7

        I use C# ;P

        We made the buttons on the screen look so good you'll want to lick them. Steve Jobs

        1 Reply Last reply
        0
        • M Monty2

          ... i will never ever write a base class without a virtual destructor :mad:


          I don't believe in failure. It is not failure if you enjoyed the process.

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

          Check out PC Lint - it can spot that particular gaff... :)

          A 1 Reply Last reply
          0
          • M Monty2

            Roger Stoltz wrote:

            How long did it take you to locate the error?

            Running in debug mode detected memory leaks (it was an abstract base class) and after a good solid hour or so of rearranging code it hit me to check and me the supreme coder havn't even added a destructor :mad:


            I can only please one person a day... today is not your day

            N Offline
            N Offline
            Nirosh
            wrote on last edited by
            #9

            In C# compiler add it for you, doesn't it..? just a good practise in the manage world

            L.W.C. Nirosh. Colombo, Sri Lanka.

            P 1 Reply Last reply
            0
            • A Aryo Handono

              for(int i = 0;i < 100;i++) {   print("I will never ever write a base class without a virtual destructor."); } :-D:-D

              "Courage choose who will follow, Fate choose who will lead" - Lord Gunner, Septerra Core "Press any key to continue, where's the ANY key ?" - Homer Simpsons Drinking gives me amazing powers of insight. I can solve all the worlds problems when drunk, but can never remember the solutions in the morning. - Michael P Butler to Paul Watson on 12/08/03

              A Offline
              A Offline
              Anton Afanasyev
              wrote on last edited by
              #10

              why only 100?;P


              :badger:

              1 Reply Last reply
              0
              • M Monty2

                ... i will never ever write a base class without a virtual destructor :mad:


                I don't believe in failure. It is not failure if you enjoyed the process.

                W Offline
                W Offline
                Weiye Chen
                wrote on last edited by
                #11

                ... i will never ever write a base class without a virtual destructor. ;P

                Weiye Chen Give me the Death Note, and I'll cleanse the world...

                1 Reply Last reply
                0
                • L Lost User

                  Check out PC Lint - it can spot that particular gaff... :)

                  A Offline
                  A Offline
                  Anand Vivek Srivastava
                  wrote on last edited by
                  #12

                  GNU GCC points out the error when compiled with -Wall option.

                  1 Reply Last reply
                  0
                  • M Monty2

                    ... i will never ever write a base class without a virtual destructor :mad:


                    I don't believe in failure. It is not failure if you enjoyed the process.

                    V Offline
                    V Offline
                    Vikram A Punathambekar
                    wrote on last edited by
                    #13

                    You probably know about this already, but I hope somebody finds this of some use: The Rule of Three[^] :)

                    Cheers, Vikram.


                    "Life isn't fair, and the world is full of unscrupulous characters. There are things worth fighting for, killing for and dying for, but it's a really small list. Chalk it up to experience, let it go, and move on to the next positive experience in your life." - Christopher Duncan.

                    M 1 Reply Last reply
                    0
                    • V Vikram A Punathambekar

                      You probably know about this already, but I hope somebody finds this of some use: The Rule of Three[^] :)

                      Cheers, Vikram.


                      "Life isn't fair, and the world is full of unscrupulous characters. There are things worth fighting for, killing for and dying for, but it's a really small list. Chalk it up to experience, let it go, and move on to the next positive experience in your life." - Christopher Duncan.

                      M Offline
                      M Offline
                      Monty2
                      wrote on last edited by
                      #14

                      Vikram A Punathambekar wrote:

                      You probably know about this already

                      Yep i know but that a really good tutorial thanks for the link :)


                      Used on me in a bar: Have you considered suing your brains for non-support?

                      1 Reply Last reply
                      0
                      • M Monty2

                        ... i will never ever write a base class without a virtual destructor :mad:


                        I don't believe in failure. It is not failure if you enjoyed the process.

                        P Offline
                        P Offline
                        Phillip Martin
                        wrote on last edited by
                        #15

                        I hate tracking down things like this. Not a good way to spend the day! This (among many others) is one of the reasons we use PCLint[^] to help check our code. It's awsome. The output by itself is not that friendly, but there are a number of tools that help present and filter the information for you in a much more useful manner.We use our own in house one. So much time can be wasted on small problems like these ones, so anything that helps us identify them, that has gotta be good. - Phil

                        M 1 Reply Last reply
                        0
                        • P Phillip Martin

                          I hate tracking down things like this. Not a good way to spend the day! This (among many others) is one of the reasons we use PCLint[^] to help check our code. It's awsome. The output by itself is not that friendly, but there are a number of tools that help present and filter the information for you in a much more useful manner.We use our own in house one. So much time can be wasted on small problems like these ones, so anything that helps us identify them, that has gotta be good. - Phil

                          M Offline
                          M Offline
                          Monty2
                          wrote on last edited by
                          #16

                          hmm thanks i will take a look at it, Anna here works on visual lint i think.


                          Steady As She Goes!

                          A 1 Reply Last reply
                          0
                          • M Monty2

                            ... i will never ever write a base class without a virtual destructor :mad:


                            I don't believe in failure. It is not failure if you enjoyed the process.

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

                            ...Effective C++[^]. ;)

                            Anna :rose: Linting the day away :cool: Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                            C 1 Reply Last reply
                            0
                            • M Monty2

                              hmm thanks i will take a look at it, Anna here works on visual lint i think.


                              Steady As She Goes!

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

                              I do indeed. :) If there's anything you need to know, feel free to ask. Our own stuff aside, we're developing quite an insight into how to tune PC-Lint to make the output useful...

                              Anna :rose: Linting the day away :cool: 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
                              • A Anna Jayne Metcalfe

                                ...Effective C++[^]. ;)

                                Anna :rose: Linting the day away :cool: Anna's Place | Tears and Laughter "If mushy peas are the food of the devil, the stotty cake is the frisbee of God"

                                C Offline
                                C Offline
                                Chris Maunder
                                wrote on last edited by
                                #19

                                C# ;) C'mon, someone was going to say it...

                                cheers, Chris Maunder

                                CodeProject.com : C++ MVP

                                P A 2 Replies Last reply
                                0
                                • N Nirosh

                                  In C# compiler add it for you, doesn't it..? just a good practise in the manage world

                                  L.W.C. Nirosh. Colombo, Sri Lanka.

                                  P Offline
                                  P Offline
                                  Pierre Leclercq
                                  wrote on last edited by
                                  #20

                                  In C#, the thing that has a destructor syntax is a finalizer. It is recommended to avoid manually adding one. But if you want to use the Dispose pattern you have to add one. Still whatever you do, you can't know when that memory will be released... (Which might be never, if you forget to let go of that reference)

                                  1 Reply Last reply
                                  0
                                  • C Chris Maunder

                                    C# ;) C'mon, someone was going to say it...

                                    cheers, Chris Maunder

                                    CodeProject.com : C++ MVP

                                    P Offline
                                    P Offline
                                    Pierre Leclercq
                                    wrote on last edited by
                                    #21

                                    C++ is a sharp knife, so a little scratch on your finger might happen. Is C# as sharp as C++?

                                    A 1 Reply Last reply
                                    0
                                    • C Chris Maunder

                                      C# ;) C'mon, someone was going to say it...

                                      cheers, Chris Maunder

                                      CodeProject.com : C++ MVP

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

                                      'shame we can't use it. ;P ;P ;P

                                      Anna :rose: Linting the day away :cool: 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 Pierre Leclercq

                                        C++ is a sharp knife, so a little scratch on your finger might happen. Is C# as sharp as C++?

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

                                        Not until they add const. :doh:

                                        Anna :rose: Linting the day away :cool: 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
                                        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