是不是所有的C ++编译器生成C code? [英] Do all C++ compilers generate C code?

查看:114
本文介绍了是不是所有的C ++编译器生成C code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是一个pretty模糊和宽泛的问题,但做的所有C ++编译器编译code到C首先它们编译成机器code过吗?

Probably a pretty vague and broad question, but do all C++ compilers compile code into C first before compiling them into machine code?

推荐答案

由于C编译器几乎是无处不在,可几乎每一个平台上,有很多(编译)语言通过这个阶段去他们的发展来引导的过程。

Because C compilers are nearly ubiquitous and available on nearly every platform, a lot of (compiled) languages go through this phase in their development to bootstrap the process.

在语言发展的早期阶段,看的语言得到一个工作编译出来的最简单的方法是建立一个编译器转换成你的语言为C然后让原生的C编译器构建实际的二​​进制可行的。

In the early phases of language development to see if the language is feasible the easiest way to get a working compiler out is to build a compiler that converts your language to C then let the native C compiler build the actual binary.

这样做的问题在于语言的特定结构都将丢失,从而为优化潜力的机会可能会因此错过了在第二阶段大多数语言中得到自己的专用编译前端的理解语言特定构建体和基于这些构建体可因此提供优化策略。

The trouble with this is that language specific constructs are lost and thus potential opportunities for optimization may be missed thus most languages in phase two get their own dedicated compiler front end that understands language specific constructs and can thus provide optimization strategies based on these constructs.

C ++已经走过阶段和第二阶段了2二十多年前。所以很容易找到一个专用于C ++和产生直接传递到支持的中间格式编译器的'前端'。但你仍然可以被编译之前发现的C ++被翻译成C(作为中间格式)的版本。

C++ has gone through phase 1 and phase 2 over two decades ago. So it is easy to find a `front end' of a compiler that is dedicated to C++ and generates an intermediate format that is passed directly to a backed. But you can still find versions of C++ that are translated into C (as an intermediate format) before being compiled.

这篇关于是不是所有的C ++编译器生成C code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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