Sign in to follow this  
daniel_i_l

Looking for sympathy

Recommended Posts

I've been going over a piece of code for 2 hours only to find that I'd done: if(...); Does stuff like that ever happen to you guys? How can I stop making those dumb mistakes? Thanks.

Share this post


Link to post
Share on other sites
Still happens, but less than it used to so best advice is just keep going. You'll never stop making these "trivial" errors but your brain does get better at spotting them with practice.

Some compilers can be set to warn against possible common syntax errors like these, although there is no substitute for making the same mistakes over and over so many times that you stop making them in the first place.

Share this post


Link to post
Share on other sites
I second what EasilyConfused says. These things are just part of being a programmer. The more you program the less frequent they are. Plus that mistake was actually findable. A lot worse are the ones where one character is wrong and it is something that could be right in another circumstance.
The longer one programs the more one gets into a particular style of programming (the way classes are designed etc.). Then mistakes happen less often because you only change the actual mathematical logic from project to project.

Enough babbling, Im going to bed :)

-CProgrammer

Share this post


Link to post
Share on other sites
I can offer my worst experience, maybe that can cheer you up =).

I once spent six months debugging som assembler i had written.
I had forgotten an h at a number, so the code overwrote itself. :(

Worst thing with these things is that once you find them, you arent really
happy anyway, just slightly less annoyed...

But as they said, things like that doesnt happen that often after a while.
And most importantly, before you learn to not do them, you quickly learn to look for them.

Share this post


Link to post
Share on other sites
Ah, we all do that. Out of interest, what compiler are you using? VC 2005 catches that with a warning (On highest warning level, I never use anything lower).

Share this post


Link to post
Share on other sites
Yeah happens all the time...

A good thing to do (if you can afford it) is to use "code nazi" software like PcLint that that will catch this kind of thing (as well as whole bunch of other anal stuff :) ).

Share this post


Link to post
Share on other sites
Thanks for the replies!
Evil Steve: I'm using devC++, is that bad? I mean, I have VC++ (the free express version) but I got intimidated by all the options and havn't had time to jump into it, I also had problems with the #include<windows.h> files and other windows programming. Should I change anyway?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by daniel_i_l
Thanks for the replies!
Evil Steve: I'm using devC++, is that bad? I mean, I have VC++ (the free express version) but I got intimidated by all the options and havn't had time to jump into it, I also had problems with the #include<windows.h> files and other windows programming. Should I change anyway?


Add -Wall to the compiler command in dev-c++ to enable all warnings. I belive that would have caught this.

Share this post


Link to post
Share on other sites
Once (Ok a few times) I spent an entire weekend hunting down what turned out to be a missing semi-colon. At first I thought that I had learned from it, then when I started my internship, do you know what the first mistake that I made was? Yup, a missing semi-colon.
Programming mistakes are quite common. We all have typos or goofs, or when we code whilst not mentally there (i.e. sober). Best thing to do is to find it and fix it. Many people here do it so they won't really hold it against you if they see something like that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this