Doomulation
?????????????????????????
Interesting... I'll have a look at this. Note that it accepts a void* arguments, which means that you can't have a function declaration which accepts an argument with anything else than void*.
UPDATE:
After studying it a little, I think I grasp what you're doing.
You're basically using a dummy class to define a pointer to a class in the thread structure... you're basically using unions (can't say I know much about them) so that data will duplicated into different types of pointers. That way, you could have a class function pointer and a global function pointer with the same address. That way, all you need is check if we're doing a class callback or not, then access the appropriate struct members...
Of course, when calling the new thread procedure, you simply cast the class function to the class function pointer for your dummy class...
I never would have thought that way. It shows that it works if you think hard enough.
But I can't say that it's much better than assembly, because this is pretty much stretching the language to its limits. It's in no way a standard procedure and is very dangerous.
UPDATE:
After studying it a little, I think I grasp what you're doing.
You're basically using a dummy class to define a pointer to a class in the thread structure... you're basically using unions (can't say I know much about them) so that data will duplicated into different types of pointers. That way, you could have a class function pointer and a global function pointer with the same address. That way, all you need is check if we're doing a class callback or not, then access the appropriate struct members...
Of course, when calling the new thread procedure, you simply cast the class function to the class function pointer for your dummy class...
I never would have thought that way. It shows that it works if you think hard enough.
But I can't say that it's much better than assembly, because this is pretty much stretching the language to its limits. It's in no way a standard procedure and is very dangerous.
Last edited: