Inherent code performance advantages of D over C?

Walter Bright newshound2 at digitalmars.com
Sat Dec 14 11:30:00 PST 2013


On 12/14/2013 9:19 AM, Timon Gehr wrote:
> On 12/11/2013 12:46 AM, Walter Bright wrote:
>> On 12/10/2013 3:04 PM, Timon Gehr wrote:
>>> Malloc is part of the language runtime. Everything needed is known
>>> about it, in
>>> particular that it is pure (in the D sense). Also, the source code of
>>> malloc
>>> will not be standard C code.
>>
>> All right, so write your own storage allocator. How are you going to
>> tell the C compiler that it's pure?
>
> How about the D compiler?

You can cast the result to const/immutable, which is why the casting is 
possible. It tells the compiler things that cannot be deduced.


More information about the Digitalmars-d mailing list