This is a big reason why I haven’t really touched dynarec in a good while.
So I was writing up the whole pseudo asm dealie, works a lot how I’m doing it with x86 opcodes now except more generic. At compile time I wanted to translate the generic ones to the real calls, that’s easy… registers not so much. So me placing way too much trust in the abilities of the cpp though I could maybe have it figure out the correct translation at compile time. Short answer no you can’t, not in a million years.
Which brings me to a question, why can the C preprocessor do meta-programming, true metaprogramming not done through boost preprocessor lib. How awesome would it be if there was a like a #program keyword, I think pretty fucking awesome. If you’re sitting there thinking “why doesn’t he just do it at runtime?” The answer to that is cause registers aren’t going to change after you compile (the host arch registers I mean), so why can’t handle translation at compile time?
So this has me thinking whether I should either make a pre-cpp or just totally replace it. Neither are very appealing. What’s really annoying is the latest spec for the cpp was made in 2005 and no one thought to add real meta-programming.
Peace. Out.comments powered by Disqus