Java到C ++转换器/工具 [英] Java to C++ converter/tool

查看:1124
本文介绍了Java到C ++转换器/工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



可能是一个将Java语法转换为C ++语法的工具。



我知道语言不同..但是简单的事情,如语义匹配1到1的循环。



有这样的工具吗?

解决方案

只要有足够的时间,金钱和资源,就可以做任何事情。是否实用?超越琐碎的例子不是真的。或者取决于什么是可接受的错误率。



真正的问题是Java和C ++中的习语不同。 Java到C#例如实际上会容易得多(因为习语更相似)。最大的当然是C ++有析构函数和手动管理的内存。 Java对这种行为使用finally块,并具有垃圾回收。



此外,Java还有一个通用的Object超类型。 C ++不能。



模板的泛型对我来说是不可能的。


I always asked myself if it would be possible to make a Java2C++ Converter.

Maybe a Tool that converts the Java Syntax to the C++ Syntax..

I am aware that the languages differ .. but simple things like loops where the semantics match 1 to 1 ..

Is there such a tool? Or is it possible to make one ?

解决方案

It's possible to do anything given enough time, money and resources. Is it practical? Beyond trivial examples not really. Or rather it depends on what constitutes an acceptable error rate.

The real problem is that the idioms are different in Java to C++. Java to C# for example would actually be far easier (because the idioms are much more similar). The biggest of course is that C++ has destructors and manually managed memory. Java uses finally blocks for this kind of behaviour and has garbage collection.

Also Java has a common Object supertype. C++ doesn't.

The generics to templates would be nigh on impossible I would imagine.

这篇关于Java到C ++转换器/工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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