Why did D leave the programming language shootout and will it return?

Christophe travert at phare.normalesup.org
Fri Sep 23 02:29:23 PDT 2011


Walter Bright , dans le message (digitalmars.D:145096), a écrit :
> On 9/23/2011 12:27 AM, Heinz Saathoff wrote:
>> Walter Bright wrote...
>>> Once subtlety that Andrei and I suspect will have a huge impact in the future is
>>> that we've carefully designed the semantics of structs so they can be moved
>>> around in memory with a simple bitcopy.
>>>
>>> (In contrast, C++ must invoke the copy constructor.)
>>
>> Only if a user supplied constructor is defined. The compiler generated
>> constructor is just a bit copy and the destructor a null-operation.
>> The rule in C++ is that you only pay for what you use.
> 
> Yes, I understand that those operations may be trivial. On the other hand, there 
> is no limit to their complexity.

My C++ compiler don't even call a constructor when it is not trivial. 
And it is rarely as trivial as it should be when you use things like 
containers and smart pointers.

myStruct a = someFun();

Don't always call the copy constructors and destructors, even it should 
run them twice (one for the return statement, and one for the 
construction).
I had a program working thanks to this. I forgot to implement the copy 
constructor (which doesn't mean it was trivial), and the destructor 
should have destroyed my data.

But that is buggy behavior that we don't have to care about when we use 
D.


More information about the Digitalmars-d mailing list