What guarantees does D 'const' provide, compared to C++?
Mehrdad
wfunction at hotmail.com
Sat Aug 18 16:28:53 PDT 2012
On Saturday, 18 August 2012 at 22:04:21 UTC, Peter Alexander
wrote:
> 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.
Right, most optimizations are not applicable to general cases.
More information about the Digitalmars-d
mailing list