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. Other Discussions
  3. Clever Code
  4. Do you think this is a bad idea or not( C++)

Do you think this is a bad idea or not( C++)

Scheduled Pinned Locked Moved Clever Code
c++debugginghelpquestion
24 Posts 11 Posters 30 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.
  • R Rama Krishna Vavilala

    Exactly. I was expecting this answer. Many programmer get excited that their program continues to run inspite of an exception like access violation and forget that there might be something dangerous that occured like memory overwrite etc. so the program may not be in a valid state to continue. I had tough time convincing one of the programmer to drop that habit.


    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

    S Offline
    S Offline
    Stephen Hewitt
    wrote on last edited by
    #21

    I've had similar experiences. I've also had to debug code which had bugs caused by such code and in the worst case the problem took weeks to track down.

    Steve

    1 Reply Last reply
    0
    • R Rama Krishna Vavilala

      Exactly. I was expecting this answer. Many programmer get excited that their program continues to run inspite of an exception like access violation and forget that there might be something dangerous that occured like memory overwrite etc. so the program may not be in a valid state to continue. I had tough time convincing one of the programmer to drop that habit.


      Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #22

      In Visual Basic, this error is known as On Error Resume Next. I'm trying to get rid of this in a product I'm maintaining.

      Stability. What an interesting concept. -- Chris Maunder

      R 1 Reply Last reply
      0
      • M Mike Dimmick

        In Visual Basic, this error is known as On Error Resume Next. I'm trying to get rid of this in a product I'm maintaining.

        Stability. What an interesting concept. -- Chris Maunder

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

        Mike Dimmick wrote:

        On Error Resume Next

        Actually, it is not as bad as the catch all. catch all can have severe problems.


        Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

        M 1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          Mike Dimmick wrote:

          On Error Resume Next

          Actually, it is not as bad as the catch all. catch all can have severe problems.


          Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

          M Offline
          M Offline
          Mike Dimmick
          wrote on last edited by
          #24

          We had On Error Resume Next in a method of a COM class which looked like this:

          Public Sub FormatMessage(vtArgs() As Variant)
          For i = 0 To UBound(vtArgs)
          ' Do something
          Next
          End Sub

          This was fine when called from a VB6 client, but in VB.NET it was possible to pass Nothing as the argument. Trying to do UBound(vtArgs) caused an error to be raised, but the next statement was the next call to UBound(vtArgs). Result: infinite loop. Hmm, maybe I should post that...

          Stability. What an interesting concept. -- Chris Maunder

          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