可以将C ++编译为平台无关的代码吗?为什么不? [英] Can C++ be compiled into platform independent code? Why Not?

查看:76
本文介绍了可以将C ++编译为平台无关的代码吗?为什么不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将C ++程序编译到某个中间阶段(类似于Java中的字节码),在该阶段中输出是平台无关的,而不是稍后在运行时编译/链接以以本机(依赖于平台的)代码运行?
如果答案为否,为什么?

Is it possible to compile C++ program into some intermediate stage (similar to bytecode in java) where the output is platform independent and than later compile/link at runtime to run in native (platform dependent) code? If answer is no, why?

推荐答案

确实有可能,例如参见 LLVM

It is indeed possible, see for example LLVM.

这篇关于可以将C ++编译为平台无关的代码吗?为什么不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆