Maybe it is better to use the shorter version. Don't link to the quote, though... that ruins the effect.
Maybe it is better to use the shorter version. Don't link to the quote, though... that ruins the effect.
For one project I'm involved with we have one developer who is in charge of producing bugs.
I generally use the debugger when it works with printf but crashes without printf. Oh those are the fun bugs
Well, the code I write tends to either work perfectly or fail in a spectacular manner. My general debuggin technique is to look at the code, then add some Beep()'s in to see where it is running and where it craps out. Of course theres always the comment everything out until it stops crashing method. I generally use incremental build and auto-precompiled headers, so I usually only have to recompile the one file im in and then relink, takes maybe 10 seconds. Now if I have to recompile all 100,000 lines of code it takes like 2 minutes, which gets annoying. The fact I never use the debugger, and in fact rarely even compile the debug version drives my boss nuts, but most of the bugs I have to find arent ones that will show up in the debugger anyway.
Last edited by abachler; 11-06-2007 at 04:04 PM.
It's not the compile step that takes forever for me. Our build system manages that correctly. If only one file has changed, only one file gets recompiled.
The linking step itself takes several minutes. JUST TO LINK. This is due to a poor choice of algorithm inside the GNU linker that scales terribly when you use many, many archive libraries. And yes, I've profiled it, traced it down, and proven it. If you are linking across an NFS share things get almost 3x worse. And of course, our product consists of 25 or 30 libraries, so the problem is greatly amplified.
I actually tried creating a customized linker tool which merged ELF objects into larger and larger archives to feed into the linker -- it links much faster that way. The resulting tool was brittle and I never trusted the code it produced, so I stopped using it. Now I just put up with the stupidly slow link time.
On other systems, where the linker is not GNU, the product links in seconds.
I don't understand how writing to cout or printf or adding beeps can be easier than running through the debugger, especially if you're using the VC++ debugger. I guess if it works for you, fine, but maybe a few weeks getting used to all the bells and whistles (no pun intended) available could make you even more productive.
Well, as I said, most of the undocumented features in ym programs arent the kind that will crash the app, they just cause it to display interesting behavior. Even the app crashing bugs are usually easy enough to track down, 99% of them are a bad pointer. In fact the one that made me use the debugger was a bad pointer, but the source was convoluted. I was randomizing the sequence of an array of pointers and somehow a NULL was creeping in even though it 'shouldnt'. Ultimately the whole thing was resolved with a check for NULL prior to executing a function that took the pointer as an argument. I am using a pointer to an array of pointers, so 6.0 just showed me the value of the base pointer, while 2005 showed me the contents of the array ( which is why I can say I like 2005 better than 6.0 without lying about having never needed to use either one before).
>> I don't understand how writing to cout or printf or adding beeps can be easier than running through the debugger,
I'm afraid of my debugger -- never used it. It could be complicated and I could fail at. It's an insecurity thing really.
I've never found a debugger I liked. Never used VC++ and I won't use microsoft compilers anymore (bad incident with one a long time ago). In fact I hardly even use GUI frontends anymore. I have a good text editor and some good command line tools.
That and the output method is pretty universal so when I'm flipping between a bunch of languages I don't have to remember which debugger does what.
>> I'm afraid of my debugger -- never used it.
I would put the debugger at #1 on my list of favorite/most helpful development tools. I use it more than any other part of the IDE. The VC++ debugger is extremely powerful and makes my life so much easier. I use it even when looking at code of people who post questions here.
The simple parts are extremely helpful by themselves, including breakpoints, step over/step into/step out and the watch windows. More advanced stuff like modified breakpoints, the memory windows, set next statement and editing memory values as you go are great.
I don't even use the Edit and Continue feature, either, which if it works could be fantastic.
My list of best inventions ever goes something like this:
TiVo
The wheel
VC++ debugger
Tabbed browsing
Sliced bread
If you're already using VC++, learning the debugger is a no-brainer (unless of course you're completely happy with how you're doing things right now).
>> I've never found a debugger I liked.
I was never much of a fan of gdb when I used it long ago. There's a big difference between command line debuggers and a visual debugger. If you're not compiling with VC++, though, then it doesn't matter how good its debugger is. I don't know if there are any other visual debuggers for C++ that compare.
Last edited by Daved; 11-06-2007 at 04:59 PM.
Wait. I have used the debugger but I assure you it was an accident. Something to do with just-in-time debugging and an assumption that hitting return fast and hard would make it go away... Would it really be as fast as writing some printing statements and such, Daved? Might take a look at it the next time I'm coding something. It always seemed a bit overkill to me in my simple world to be honest. Aside from the features you mentioned which others would be worth playing with?
I used to get those. The program wouldn't work so I'd put a couple printfs to debug. For whatever reason it would then work. Then I'd take out the printfs expecting the program to not work but it would still work and no other code had changed other than adding/commenting out those printfs. Yeah... fun indeed.
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
>> (bad incident with one a long time ago)
Deaths?