??? 10/19/11 07:40 Read: times |
#184269 - the programmer blindness |
In assembler (not on a '51, but that's unimportant) the equivalent of a switch/case statement with consecutive values went like: dec a jz DO_SOMETHING dec a jz DO_SOMETHING_ELSE dec a jz DO_SOMETHING_ELSE ;do the same for both cases dec a jz DO_SOMETHING_DIFFERENT dec a jz DO_SOMETHING_MORE etc. I needed to insert one value into the list (and shift the rest). As the "insert into list" involved also changing several tables and some other code, I did it conditionally so that I can revert quickly in case of problems. Of course I use copy-paste often. dec a jz DO_SOMETHING dec a jz DO_SOMETHING_ELSE dec a jz DO_SOMETHING_ELSE ;do the same for both cases dec a .if NEW_STUFF dec a jz DO_THE_NEW_STUFF .endif jz DO_SOMETHING_DIFFERENT dec a jz DO_SOMETHING_MOREThe error went unnoticed for years, as its symptoms were incidentally masked (by the order of commands arriving from a different device). Now the error somehow surfaced and I had to find it. After a couple of tests i KNEW it is in this sequence, but it took me half a day to spot it. Of course, most of bugs look trivial *after* you find it. JW |
Topic | Author | Date |
the programmer blindness | 01/01/70 00:00 | |
split hairs | 01/01/70 00:00 | |
Double Dec | 01/01/70 00:00 | |
unreachable code | 01/01/70 00:00 | |
Analysis tools | 01/01/70 00:00 | |
re: blindness | 01/01/70 00:00 | |
re:blindness | 01/01/70 00:00 | |
Thanks all for the comments. | 01/01/70 00:00 | |
but remember | 01/01/70 00:00 | |
What is this, really? | 01/01/70 00:00 |