What guarantees does D 'const' provide, compared to C++?

Peter Alexander peter.alexander.au at gmail.com
Sat Aug 18 15:04:20 PDT 2012


On Saturday, 18 August 2012 at 20:22:59 UTC, Mehrdad wrote:
> On Saturday, 18 August 2012 at 11:26:01 UTC, Peter Alexander 
> wrote:
>> In D, const without immutable is meaningless.
>
> lol, that was the whole point of this question... the whole 
> point of Jon's example was to show it's not meaningless even 
> without immutable. :)

Jon is right. If you can guarantee that there are no other 
references then const can provide some guarantees, but in general 
you don't know if there are other references.


More information about the Digitalmars-d mailing list