I read bytes from the buffer. But sometimes what I read is a word or longer.
// assume buffer is of type unsigned char * read_ptr(buffer+(position++))
This is great, but how can I place a position adjusted for 2 or 4? I can't force the operator += post-increment, right?
The reason is that I have this big terrible expression that I want to appreciate, while at the same time increasing the position variable.
I think I came up with my solution. I am sure it works. However, everyone will hate it because it is not very readable code.
read_ptr(buffer+(position+=4)-4)
Then I will do it in the macro, checking it a bit to make sure that it is doing the right thing.
IN CUSTODY:
Do not do this. This is just a bad idea because it is what code that generates indescribable code. But ... it turned out that converting any pre-incremental statement into a post-incremental process is pretty easy.
source share