const as default for variables
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 16 12:46:22 PDT 2015
On Monday, 16 March 2015 at 00:07:32 UTC, Walter Bright wrote:
> 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.
That is true.
More information about the Digitalmars-d