-
Content Count
243 -
Joined
-
Last visited
-
Days Won
11
Single Status Update
-
Rewriting the program again. But, this time.. wow.
-
Good wow. The old code wouldn't have passed a professional review, it had dangerous things like pointer arithmetic.
Which is fine since I'm not submitting this to an employer. But, the danger meant the program could and did develop bugs. These bugs might occur at an early phase in the reverse compilation process, but only present themselves later. This made it difficult to figure out what was wrong, and often meant fixing several layers of code.
The new code is 10% smaller, and 100% clearer. Here's an example:
Quoteint Val;
if (_at_least(CurPos, EndFile, sizeof(int)))
{
std::reverse_copy(CurPos, CurPos + sizeof(int), _to_byte_ptr(Val));return Val;
}
else { throw CurPos; }The contents of _at_least, std::reverse_copy, and _to_byte_ptr were all in one big function. Yuck.
Finally, I can get back to solving what appears to be the last two problems for the reverse compiler.