Assembling while tired

edited November 2007 in Development
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...)
Post edited by Winston on

Comments

  • edited November 2007
    I can recommend writing Z80 assembler after a bottle or two of blackberry wine. It's fun chasing those mnemonics across the screen as the room spins, and trying to match the pushes and pops to see if you've left something on the stack at the end of the routine. Oddly enough, the code never seems to make quite as much sense the next morning.
    Still supporting Multi-Platform Arcade Game Designer, currently working on AGD 5. I am NOT on Twitter.
    Egghead Website
    Arcade Game Designer
    My itch.io page
  • edited November 2007
    Winston wrote: »
    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...)

    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
  • edited November 2007
    Kiwi wrote: »
    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!
  • edited November 2007
    You think coding in z80 while tired is bad? Try writing the actual assembler while tired, that's a laugh and a half! That's my excuse for any remaining bugs in SPIN's and I'm sticking to it :p

    Marko
  • edited November 2007
    My own personal fave? Herbal Nytol. It tends to give me the most interesting[1] of programming ideas that must be investigated there and then.

    [1] For some value of interesting.
  • edited November 2007
    Everytime I try and code when drunk I fail, the moment it gets complicated I fire up Internet Explorer and look at porn instead.

    Which I could do that at work! :D
  • edited November 2007
    Winston wrote: »
    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...)

    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/
  • edited November 2007
    ah - a pascal/modula 2 lover ;)

    but i would have to agree
  • zubzub
    edited November 2007
    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.

    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.
    FUSE: the Free Unix Spectrum Emulator, also for Windows, OS X and more!
    http://fuse-emulator.sourceforge.net/
Sign In or Register to comment.