[bind10-dev] Shared pointers, references and guideline

Michal 'vorner' Vaner michal.vaner at nic.cz
Mon Jun 3 07:43:36 UTC 2013


Hello

On Sun, Jun 02, 2013 at 12:20:35AM +0200, Florian Weimer wrote:
> Another consideration is that the const & variant is not always safe
> due to aliasing.  Sometimes, it is necessary to increment the
> reference count.

Aliasing? You mean the fact that a pointer should start at address divisible by
4/8 (depending on architecture)?

And, it should generally be safe, because as long as the referred shared pointer
object exists (eg. the one the & points to, which it must in correct code), the
reference count is at least 1 for that pointer ‒ which is enough to keep the
pointee object alive. As long as it is alive while being accessed, nobody really
cares what the number of references really is.

Or is there something else I don't understand?

Thank you

-- 
Einstein argued that there must be simplified explanations of nature, because
God is not capricious or arbitrary.  No such faith comforts the software
engineer.
                -- Fred Brooks

Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20130603/1a1e5d01/attachment.bin>


More information about the bind10-dev mailing list