Compile-time evaluation of real expressions?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jan 6 18:28:57 PST 2012


On Sat, Jan 07, 2012 at 02:15:39AM +0000, Robert Clipsham wrote:
> On 07/01/2012 00:31, H. S. Teoh wrote:
> >I admit I've no idea how the D compiler implements compile-time
> >evaluation, but is it possible for the compiler to actually emit code
> >for compile-time functions containing asm blocks and, say, execute it
> >in a sandbox, and read the values out from the machine registers? Or
> >does this create more problems than it solves?
> 
> Doing this would mean you can't do cross-compilation, eg using x86 to
> compile for ARM. Which means you'd need to use a virtual machine for
> it, which is almost certainly more effort than it's worth.
[...]

But doesn't the use of asm{} already prevent cross-compilation in the
first place? Or does the D compiler actually translate the instructions
into the target platform? In which case, doesn't it already know enough
to be able to interpret it?

I'm pretty sure I'm missing something obvious.


T

-- 
Customer support: the art of getting your clients to pay for your own incompetence.


More information about the Digitalmars-d-learn mailing list