Weird code problems...
-
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
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 :-)
-
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
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!
-
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
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
-
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
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"
-
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
have done that more than once ... :-D Regards Ray "Je Suis Mort De Rire"
-
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
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
-
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
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."
-
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
-
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"
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
-
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."
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