Explicit default constructor for structs

Jonathan M Davis jmdavisProg at gmx.com
Fri Apr 11 12:49:02 PDT 2014


On Friday, April 11, 2014 17:00:50 Remo wrote:
> On Friday, 11 April 2014 at 12:38:14 UTC, Daniel Murphy wrote:
> > "monarch_dodra" wrote in message
> > news:rftskgfoeuvyeuvrusei at forum.dlang.org...
> > 
> >> *BUT*, if you happen to copy paste C++ code, and it *does*
> >> compile, then it is pretty much expected to keep the same
> >> resulting semantics, yes.
> > 
> > These expectations will lead to disappointment.
> 
> Why everyone here seems to confuse portion with copy and paste?
> Of course C++ code that is just copy and pasted will not work or
> not work as expected.
> But I think (hope) that one of the advantage of D is that it
> allow to easily PORT C/C++ code.
> If this is not the case and was really not intended then it is
> probably better to use C++14 instate.
> Other advantage of D could be easy interconnection of C/C++
> libraries and D...

How easy it is to port C++ to D depends on what the code does. Some styles of 
code and types of operations will port over very easily, whereas others would 
require a fair bit of refactoring. For the most part, the changes that you'd 
be forced to make would be for the better, but if a lot of your code is doing 
stuff that doesn't port easily, then it could be painful to port.

Personally, I'd probably rewrite the code in D and just use the C++ as a 
reference rather than trying to really port it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list