const as default for variables
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Sun Mar 15 17:07:20 PDT 2015
On 3/15/2015 1:09 PM, deadalnix wrote:
> On Sunday, 15 March 2015 at 07:44:50 UTC, Walter Bright wrote:
>> "const ref" can tell the optimizer that that path for a ref counted object
>> cannot alter its ref count.
>
> That is not clear why. const ref is supposed to protect against escaping when
> ref does not ?
Passing rc objects by const ref, for example, precludes the disastrous cases
enumerated in the "RCArray is unsafe" thread.
More information about the Digitalmars-d
mailing list