www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - C++ to D Utility?

reply "AJ" <aj nospam.net> writes:
Is there a utility to convert C++ code to D code? 
Oct 22 2009
next sibling parent reply dsimcha <dsimcha yahoo.com> writes:
== Quote from AJ (aj nospam.net)'s article
 Is there a utility to convert C++ code to D code?

No. In theory it would be possible to write one, but it wouldn't be particularly useful, as its output would likely not be readable D code. Look at some of the C code output by language x to C compilers. It's not readable C. It's filled with gotos and no high-level constructs, etc. This analogy is relevant b/c D has a C-like subset and the higher level parts are the harder parts to target programmatically. Translating into *readable* code would probably require some program that passes the Turing test.
Oct 22 2009
parent "AJ" <aj nospam.net> writes:
"dsimcha" <dsimcha yahoo.com> wrote in message 
news:hbqbas$1hct$1 digitalmars.com...
 == Quote from AJ (aj nospam.net)'s article
 Is there a utility to convert C++ code to D code?

No. In theory it would be possible to write one, but it wouldn't be particularly useful, as its output would likely not be readable D code. Look at some of the C code output by language x to C compilers. It's not readable C. It's filled with gotos and no high-level constructs, etc. This analogy is relevant b/c D has a C-like subset and the higher level parts are the harder parts to target programmatically. Translating into *readable* code would probably require some program that passes the Turing test.

OK. That shows that D is a drastic departure from C++. Why changes to code punctuation (i.e., semicolons) would matter in regards to "luring C++ programmers" is not apparent.
Oct 22 2009
prev sibling parent "Robert Jacques" <sandford jhu.edu> writes:
On Thu, 22 Oct 2009 15:11:08 -0400, AJ <aj nospam.net> wrote:

 Is there a utility to convert C++ code to D code?

There are utilities that will wrap c++ code. And DMD supports limited interfacing with c++ code compiled with DMC.
Oct 22 2009