To help LDC/GDC

deadalnix deadalnix at gmail.com
Tue Apr 9 03:48:48 PDT 2013


On Tuesday, 9 April 2013 at 03:36:28 UTC, Walter Bright wrote:
> On 4/8/2013 5:39 AM, Manu wrote:
>> But D makes no further guarantee. I don't see how const in D 
>> is any different
>> than const in C++ in that sense? That's basically the concept 
>> of const, it's not
>> a useful concept for optimisation, only immutable is.
>
> In C++, it is legal to cast away const and mutate it. That is 
> undefined behavior in D.
>
> A D compiler can assume, for example, that a const reference 
> passed to a pure function will not mutate that reference, nor 
> anything transitively referred to by that reference. No such 
> assumption can be made like that in C++.

No, D have holes in its type system and so can't ensure anything. 
It has been show many many many times, especially by Timon and 
myself, and I'm kind of fed up to have to repeat that again and 
again, especiallt since fix proposal have recieved no attention 
at all.

Stop claiming that such possibility exists, or take a serious 
look at how to really ensure it.


More information about the Digitalmars-d mailing list