Reflection
I've been busy doing my thesis work the last few months.
I'll try to do some kind of sum-up of lessons learnt;
I'll try to do some kind of sum-up of lessons learnt;
- for-loops are precious things. One of the worst kind of bugs are buffer overruns. This is since they corrupt the real time code of the program, or data structures, causing seemingly random crashes, at locations often different from where the bug actually is, also rendering debugging features of the development environment useless. The primary cause for buffer overruns are off-by-one errors, in for-loops. That's why beeing extra careful when writing the loop control code pays back bigtime. Mindstate: Which is the easiest way to express this loop? What is the natural index variable? Is it more natural with a count of loop iterations, or a start- and endvalue? A pen and paper sketch of the "structure" of the loop is probably a good idea, sadly that's not a very common situation for me.
- Debug mode is evil. See earlier post "A lesson learned the hard way". To use assert even in release mode development, redefine the assert macro using __FILE__, __LINE__ and exit() (won't display the expression at bail, but this is visible given the file/line of the assert..)