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. Weird code problems...

Weird code problems...

Scheduled Pinned Locked Moved The Lounge
comdebugginghelpquestion
20 Posts 13 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.
  • D Dana Holt

    I don't know if it's just me or what, but I just have to ask. Have you ever spent hours trying to debug a simple error that just drove you crazy, then suddenly the code started working without any changes? :wtf: This happened to me today with RegEnumValue(). I have no idea why it started working. It kept enumerating the correct number of values and returning the correct length, but both of the buffers were empty. :omg: I had already rebooted and completely rebuilt to project several times with no success. Magically it started working and has been ever since. Anyone have any weird code stories? -- Dana Holt Xenos Software

    M Offline
    M Offline
    Michael P Butler
    wrote on last edited by
    #11

    Not a weird code story but I'm reminded of the time that I spent three hours trying to figure out why my list box wasn't responding to messages. Turns out I'd drawn a combo box on the dialog and not a listbox. Doh! Michael :-)

    1 Reply Last reply
    0
    • D Dana Holt

      I don't know if it's just me or what, but I just have to ask. Have you ever spent hours trying to debug a simple error that just drove you crazy, then suddenly the code started working without any changes? :wtf: This happened to me today with RegEnumValue(). I have no idea why it started working. It kept enumerating the correct number of values and returning the correct length, but both of the buffers were empty. :omg: I had already rebooted and completely rebuilt to project several times with no success. Magically it started working and has been ever since. Anyone have any weird code stories? -- Dana Holt Xenos Software

      B Offline
      B Offline
      benjymous
      wrote on last edited by
      #12

      Back when I used to code on Win98 (urrgh!) I used to get very bizarre bugs which I could only attribute to code going mad and scrambling memory (since most of the time a reboot would fix it). The worst when I collegue and I managed to trace code and noticed that a line like if( x == 10 ) was failing even when x did have a value of 10. A reboot sorted that. Thank god for the NT memory manager -- Help me! I'm turning into a grapefruit!

      1 Reply Last reply
      0
      • D Dana Holt

        I don't know if it's just me or what, but I just have to ask. Have you ever spent hours trying to debug a simple error that just drove you crazy, then suddenly the code started working without any changes? :wtf: This happened to me today with RegEnumValue(). I have no idea why it started working. It kept enumerating the correct number of values and returning the correct length, but both of the buffers were empty. :omg: I had already rebooted and completely rebuilt to project several times with no success. Magically it started working and has been ever since. Anyone have any weird code stories? -- Dana Holt Xenos Software

        S Offline
        S Offline
        Sijin
        wrote on last edited by
        #13

        A couple of days ago i spent 2 hrs trying to fix a bug

        for(int j=0;j<N;j++);
        {
        //Do something with j
        }

        N=3

        i didn't see the semicolon at the end of the for and kept wondering why j got the value 3 as soon as it entered the loop, i kept thinking that i was corrupting the stack and looked at all my new's and delete's :( :( :( only after 2 hrs did i see the semicolon, the thing was so light in my IDE VS 6 that i didn't see it at all, i wish there were a warning for errors like this :) "Do you program in Assembly ?" she asked. "NOP," he said. Sonork ID 100.9997 sijinjoseph

        R Z 2 Replies Last reply
        0
        • D Dana Holt

          I don't know if it's just me or what, but I just have to ask. Have you ever spent hours trying to debug a simple error that just drove you crazy, then suddenly the code started working without any changes? :wtf: This happened to me today with RegEnumValue(). I have no idea why it started working. It kept enumerating the correct number of values and returning the correct length, but both of the buffers were empty. :omg: I had already rebooted and completely rebuilt to project several times with no success. Magically it started working and has been ever since. Anyone have any weird code stories? -- Dana Holt Xenos Software

          R Offline
          R Offline
          Ray Kinsella
          wrote on last edited by
          #14

          Quote 'Steve Magure - Writing Solid Code' Code doesn't just fix itself, sounds to me like you should have been using Zeromemory on something. Regards Ray "Je Suis Mort De Rire"

          D 1 Reply Last reply
          0
          • S Sijin

            A couple of days ago i spent 2 hrs trying to fix a bug

            for(int j=0;j<N;j++);
            {
            //Do something with j
            }

            N=3

            i didn't see the semicolon at the end of the for and kept wondering why j got the value 3 as soon as it entered the loop, i kept thinking that i was corrupting the stack and looked at all my new's and delete's :( :( :( only after 2 hrs did i see the semicolon, the thing was so light in my IDE VS 6 that i didn't see it at all, i wish there were a warning for errors like this :) "Do you program in Assembly ?" she asked. "NOP," he said. Sonork ID 100.9997 sijinjoseph

            R Offline
            R Offline
            Ray Kinsella
            wrote on last edited by
            #15

            have done that more than once ... :-D Regards Ray "Je Suis Mort De Rire"

            1 Reply Last reply
            0
            • D Dana Holt

              Neville Franks wrote: I just hate stuff like this. The worst case is always where something works fine on one machine or flavour of Windows and not on another. These problems usually involve many sleepless nights Boy have I been there before. I have Windows 98, ME, 2K, and XP machines here that I do testing on. I do all my development under XP. I have found that my code almost always works under 2K, but there are little glitches under 98/ME quite often. I am one developer that is glad to see the 9x/ME platform's demise. :) Neville Franks wrote: Re. your specific problem are you checking that RegEnumValue() returns ERROR_SUCCESS and that RegOpenKeyEx() etc. is succeeding? Yes, I am checking all the return values in both opening the key and while enumerating it. Even when I was getting the empty buffers all the retun codes were fine, and it would enumerate the correct number of keys. I'll just have to keep an eye on it in case the problem reappears. -- Dana Holt Xenos Software

              M Offline
              M Offline
              Max Santos
              wrote on last edited by
              #16

              Dana Holt wrote: I have Windows 98, ME, 2K, and XP machines here that I do testing on. I do all my development under XP. I have found that my code almost always works under 2K, but there are little glitches under 98/ME quite often. I am one developer that is glad to see the 9x/ME platform's demise TRUE, TRUE , TRUE , very true Casa.Sapo.pt

              1 Reply Last reply
              0
              • D Dana Holt

                I don't know if it's just me or what, but I just have to ask. Have you ever spent hours trying to debug a simple error that just drove you crazy, then suddenly the code started working without any changes? :wtf: This happened to me today with RegEnumValue(). I have no idea why it started working. It kept enumerating the correct number of values and returning the correct length, but both of the buffers were empty. :omg: I had already rebooted and completely rebuilt to project several times with no success. Magically it started working and has been ever since. Anyone have any weird code stories? -- Dana Holt Xenos Software

                J Offline
                J Offline
                Jeremy Pullicino
                wrote on last edited by
                #17

                RegEnumValue is wierd... To get the val of a string that is, say 25 chars long, it sometimes returns that it needs a bigger buffer...(usually 2048 bytes). However, this behaviour is not always the same... I forgot the details, but this is how I do it: Call regenum value with an empty buffer. when it returns, I check what value it filled in lpcbData (last param). I multiply lpcbData by two. I new(lpcbData) I call RegEnumValue again. Sorry I am a bit vague in this post, but if you have been hacking around with regenumvalue you should know what I mean... Jeremy. "Hey man, Taliban, Tali me Banana."

                D 1 Reply Last reply
                0
                • S Sijin

                  A couple of days ago i spent 2 hrs trying to fix a bug

                  for(int j=0;j<N;j++);
                  {
                  //Do something with j
                  }

                  N=3

                  i didn't see the semicolon at the end of the for and kept wondering why j got the value 3 as soon as it entered the loop, i kept thinking that i was corrupting the stack and looked at all my new's and delete's :( :( :( only after 2 hrs did i see the semicolon, the thing was so light in my IDE VS 6 that i didn't see it at all, i wish there were a warning for errors like this :) "Do you program in Assembly ?" she asked. "NOP," he said. Sonork ID 100.9997 sijinjoseph

                  Z Offline
                  Z Offline
                  Zyxil
                  wrote on last edited by
                  #18

                  i turn all my code backgrounds to light grey and switch all fonts to fixedsys (you have to change thml comments to green or something, cause they're grey by default),, makes code really stand out... i also make fixedsys the default font in notepad -John

                  1 Reply Last reply
                  0
                  • R Ray Kinsella

                    Quote 'Steve Magure - Writing Solid Code' Code doesn't just fix itself, sounds to me like you should have been using Zeromemory on something. Regards Ray "Je Suis Mort De Rire"

                    D Offline
                    D Offline
                    Dana Holt
                    wrote on last edited by
                    #19

                    Ray Kinsella wrote: Code doesn't just fix itself, sounds to me like you should have been using Zeromemory on something. The scary part is that I was/am using ZeroMemory. :omg: -- Dana Holt Xenos Software

                    1 Reply Last reply
                    0
                    • J Jeremy Pullicino

                      RegEnumValue is wierd... To get the val of a string that is, say 25 chars long, it sometimes returns that it needs a bigger buffer...(usually 2048 bytes). However, this behaviour is not always the same... I forgot the details, but this is how I do it: Call regenum value with an empty buffer. when it returns, I check what value it filled in lpcbData (last param). I multiply lpcbData by two. I new(lpcbData) I call RegEnumValue again. Sorry I am a bit vague in this post, but if you have been hacking around with regenumvalue you should know what I mean... Jeremy. "Hey man, Taliban, Tali me Banana."

                      D Offline
                      D Offline
                      Dana Holt
                      wrote on last edited by
                      #20

                      Jeremy Pullicino wrote: I forgot the details, but this is how I do it: Call regenum value with an empty buffer. when it returns, I check what value it filled in lpcbData (last param). I multiply lpcbData by two. I new(lpcbData) I call RegEnumValue again. Thanks for the tip. This is actually what I am doing now, with the exception of doubling the buffer size returned. Jeremy Pullicino wrote: Sorry I am a bit vague in this post, but if you have been hacking around with regenumvalue you should know what I mean... Yes, I know all too well. ;) -- Dana Holt Xenos Software

                      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