有没有一种方法来编译C ++到C code? [英] Is there a way to compile C++ to C Code?

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

问题描述

我具有由用户配置为通过使用C ++类和节目
同一类应该被用来配置一个程序,它
只能使用C99(开放CL语言)的子集。

I have a program which is configured by the user by using C++ classes and the same class should be used to configure a program which can only use a subset of C99 (Open CL Language).

所以我的问题是:
有没有一种方法来编译C ++到C code?

So my question is: Is there a way to compile C++ to C-Code?

开源将是伟大的!

推荐答案

C ++的常见问题有可能列表:的是否有可能C ++转换为C?

The C++ FAQ has a list of possibilities: Is it possible to convert C++ to C?.

总之,它说,你不能指望这个给你特别可读code。想想涉及的复杂的;多重继承,虚函数解析,模板,操作符重载,等等,等等。有没有清洁简洁的前$ P $的纯C. pssing这些概念,如果一切你后的编译方式C,虽然,那么这可能是要走的路。

In short, it says that you can't expect this to give you particularly readable code. Think of the complexities involved; multiple inheritance, virtual-function resolution, templates, operator overloading, etc., etc. There's no clean succinct way of expressing these concepts in pure C. If all you're after is compilable C, though, then this is probably the way to go.

这篇关于有没有一种方法来编译C ++到C code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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