Assembling while tired
I really, really should not be tempted to write Z80 assembler while tired.
I just spent the best part of 4 hours taking out some really, really obvious bugs from some code I wrote two evenings ago.
I suppose at least it doesn't equal my worst programming while tired incident, a single = instead of a == in an if statement in a C++ program...which came within about half an hour of us falling at the first stage of trying to win a $100M+ contract! (And the rest of the team were equally tired and didn't spot it for hours, either...)
I just spent the best part of 4 hours taking out some really, really obvious bugs from some code I wrote two evenings ago.
I suppose at least it doesn't equal my worst programming while tired incident, a single = instead of a == in an if statement in a C++ program...which came within about half an hour of us falling at the first stage of trying to win a $100M+ contract! (And the rest of the team were equally tired and didn't spot it for hours, either...)
Post edited by Winston on
Comments
Egghead Website
Arcade Game Designer
My itch.io page
This is exactly why you should have the const on the left side of the comparsion. :D
if you do
if (a==10) {...some code...}
then you really should do
if (10==a) {...some code...}
and the compiler will complain if you use an = and not an ==
but it wont for the first one if you change == to =, it will only warn you and move on
also you should flag warnings as errors - as any good compiler would catch the = in an if statement and flag a warning
Wow! I never knew that.
Mind you, I hate it when terms are expressed in that order (this is the convention with DirectX / COM but cos the expressions are so long). I find it confusing to think of them in that order.
But then again, I am quite picky!
Marko
[1] For some value of interesting.
Which I could do that at work! :D
If I could go back and change one thing from the history of C-style languages, it would be to use = for equality and := for assignment.
--
Dr. Andrew Broad
http://geocities.com/andrewbroad/
but i would have to agree
Yeah, definitely. For any new language, though, I'd be tempted to take the belt and braces approach, and use == for equality and := for assignment. :)
My most silly bug to date has to be this one in a game of Connect 4. Oops.
http://fuse-emulator.sourceforge.net/