My Hackergotchi

Updated: Never — Philip's Blog

Now featuring regular updates!

Wed, 02 Jul 2008

21:01 – The brain is a stack

For the last couple of weeks, I've been fuzz testing some code I wrote. On its own, that sort of thing is mind-numbingly boring, so instead of just handling the problems I found the "simple way" (check for NULL before dereferencing, check if offsets make sense, etc) I decided to refactor where possible so the bugs just couldn't happen. This kept the fuzzing fun too.

Moving error handling upwards nearer to the cause of the errors in an existing code base is sometimes surprisingly tricky. Lots of reshuffling of structures, hiding data from header files and clever encapsulation tricks and pointer gymnastics.

When you're working in ten or twelve files at the same time, you realize how much like a stack the brain is and how good it is at caching information. You push the consumers of a structure on the stack and you roll it up as you change the structure. Sometimes you find yourself branching because you found a way to abstract something and when you get back, the stack is back pretty much as if it had never been gone.

I haven't been able to precisely calculate the depth of my brain stack yet, but it seems to be fairly accomodating. After a couple of hours of shuffling code around, even rough line numbers seem to be getting cached for fast retrieval too. Much fun.

Yet another research opportunity for 'students of the mind'.

Name:

Email:

URL:

Comment:


Prove that you are not a spammer: