Head Const

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 16 07:10:40 PST 2016


On 16.02.2016 14:41, Ola Fosheim Grøstad wrote:
> On Tuesday, 16 February 2016 at 13:35:56 UTC, Dicebot wrote:
>> matter how it is designed. Once you start considering it, you are
>> better at simply throwing away existing const system and starting it
>> all from scratch with D3. Logical const is harmful as it doesn't give
>> and serious guarantees but gives developer a false sense of confidence.
>
> Why is that? Doesn't non-shared const promise that the protected values
> aren't modified, until the const reference is no longer alive?
>
> Meaning: does the language allow non-const aliasing with const in
> function calls?
>
>    // prototype f(const A *, A*);
>    f(ptr,ptr);
>
> Is this disallowed? Or is it legal D? (not talking about the compiler,
> but the language spec)
>

Legal.


More information about the Digitalmars-d mailing list