octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deprecating --enable-bounds-check?


From: John W. Eaton
Subject: Re: Deprecating --enable-bounds-check?
Date: Thu, 11 May 2017 16:28:23 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 05/11/2017 04:17 PM, Rik wrote:

What is the 2x2 decision diagram for this?

          const    non-const
        |        |           |
 unique |        |           |
        |--------|-----------|
 same   |        |           |
        |        |           |

For a const object there is never a difference. It can't be modified so the indexing operator doesn't need to check the reference count or make the representation unique.

For non-const, there is always a check of the reference count. If the reference count is greater than 1, then there is a copy on the first call to the indexing operator.

jwe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]