I’ve been searching for a solution to simplify my pointer code in ALE and a comment I made in the Xojo Hangout this morning, about using negative number to identify different stacks, got me thinking.
So now, rather than having to flag each code line as well as each bit on the line to say it has or is a pointer, I just make the memory address being used as a pointer negative. So now the only check I need to make is, is the address on the code line < 0, then if so it must be a pointer. That’s the thing with memory addresses, they can generally only be positive whole numbers.
So much simpler and so many fewer checks to make and flags which need to be stored.
An additional up side to this, aside from much simpler code and improved performance, is that the code view now shows which address are being used as pointers, which is extremely helpful in debugging.
Not my idea, but it works…