On Thursday, 26 February 2015 at 16:25:59 UTC, Steven
Schveighoffer wrote:
However, we have an issue here. At any point inside the code,
you could do:
oldcount = count;
And now, there is still potentially a dangling pointer
somewhere. This means every place count is used must be
checked. In this case, all uses of count have to be re-checked
when the file is edited.
Because count leaks the memory details of the trusted call to
free (In other words, the fact that count, or any copy of it,
can become a dangling pointer), I believe every call in that
type that deals with count should be marked trusted.
The counter is freed in the destructor, nothing can happen after
that.