Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / General Programming / Programming - A Love Hate Relationship Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

April 23, 2005, 06:50 PM

I havejust finished a problem that has been driving me crazy. I am not a expert programmer and not a beginner, I fit some where in between the two.. more expert :). But now and again I come across a problem in my code that upsets me so greatly. My programming attempts are not without ambition, new operating system, 3d game engine, robotics. My recent endevor in 3d hase produced a not too shabby 3d engine, frankly the best i have done to date. I start out with a firm base and expand from there, updating components as needed. My first model loader used the 3ds which was fine, multiple objects, textures, cameras and lights but it would be virtually usless for future incarnations of the engine. So i set out to update the loader, allowing me to still use the current loader code but easly use other file types thus MLoader was born. This loader abstrated the interface allowing me to write different format loaders independant of the Mloader interface. It worked perfectly, almost. I load one object fine but when i load a second.... the progrram crashes. I try debug but it gives me no information about the problem, I start checking code every where hours pass by and no luck. I take out code, switch it with earlier versions, nothing. Then only a shot while before writing this (ramblings of a mad man) I find two lines of code right togeather hiding, tormenting me. I knew even before removing them my problem would be solved. Away they went, one compile later sweet victory. And while the expieriance was frustrating at times I can remember one time or another feeling like I wanted t quit programming all togeather it all fades away when i see the fruit of my labor. It all seems fun. (

Victor Widell

April 23, 2005, 08:16 PM

Ahhhw! What a sweet story.


April 29, 2005, 11:13 PM

I have a similar experiences. I wrote a .tga loader awhile back for a 3d engine. What was supposed to happen was I load in all the textures for any given .bsp level and everything works fine... The program kept crashing during load-time... I spent a few minutes sprinkling my code with debug tests and would print information out to a file. I traced the crash to the texture loading code for the bsp levels. Put some more debugging tests in the loading code and was able to pinpoint the crash at a specific texture extension... my .tga loader was breaking the program and causing it to crash. It was your typical out-of-bounds crash... I just had to find where exactly it was happening... It turned out that in a loop in the .tga loader, I was incrementing i by one (i++) instead of incrementing it by the number of channels in the image (i += channels). I solved this bug HOURS after I had the first crash.

A more recent problem I had was in some 4D vector code I wrote a long time ago. I was just reusing it so I -assumed- it was correct code. Oh how I was wrong! This bug lasted for a few days because I couldn't pinpoint it... It wasnt a crash bug, it was a mathematical bug that was giving wrong values for vectors. With bugs like those its even harder to find where it is. I kept stripping out functionality from the vector class, stepped through the code line-by-line... still nothing. I was browsing over the vector implementation for hours. I finally came to the normalization function... I looked at it for awhile and slammed my head against the desk! This is how I was normalizing 4d vectors:

  2. float len = Length();
  3. if(len)
  4. {
  5.     float ilen = 1/len;
  6.     x *= len;
  7.     y *= len;
  8.     z *= len;
  9.     w *= len;
  10. }

Can you see the problem? It was such a stupid mistake! I shouldve been multiplying my ilen, not len! After I changed those 4 lines of code, everything fell into place like it should... How frustrating! But hey, its part of the job description :)

I for one love solving problems, even if I'm the one that creates them!



April 30, 2005, 09:26 PM

Awesome, I recently solved a problem too. I just forgot what it was... i have way too many of them :)


May 01, 2005, 05:48 AM

...the progrram crashes. I try debug but it gives me no information about the problem...

People have lost debugging skills. Learn assembly, now! :-P

Seriously, I find it hard to believe that the crashes didn't give you any clue. Even stack corruption is perfectly tracable. Much harder bugs are the ones where there's some wrong behaviour that is hardly noticable, and totally random. Such things have kept me busy for weeks!


May 03, 2005, 02:11 PM

  2. SheepRef& mySheep = SheepProducer.produce(); // Ok, mySheep is affected
  4. ... // Many code
  6. mySheep = SheepProducer.produce(); // No effect, mySheep keeps it old state !!!

The compiler don't care about this, I was a old C programmer and a C++ beginner... How to waste one hour in one lesson !

This thread contains 6 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.