Inherent code performance advantages of D over C?
Timon Gehr
timon.gehr at gmx.ch
Sat Dec 14 16:36:30 PST 2013
On 12/14/2013 08:30 PM, Walter Bright wrote:
> 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.
I cannot cast data from my own storage allocator to immutable because
the behaviour will be undefined.
http://dlang.org/const3.html
Is this a documentation bug? What should be the actual rules?
More information about the Digitalmars-d
mailing list