Head Const

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 16 05:41:23 PST 2016


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)



More information about the Digitalmars-d mailing list