We could also do something like C++14's `make_unique<T>`, which invokes the constructor for you. Maybe `mkRefPtr<SomeObject>(Arguments, To, Some, Object, Constructor)`? (That way we wouldn't need the overhead on each declaration - we could use static analysis to prevent direct construction if we wanted).

This would take forever to switch our code over to though.

On 2015-08-02 10:54 PM, Jonas Sicking wrote:
I wonder if we could do static analysis to check of the result of "new X", where X has an AddRef member function, is assigned into a raw pointer. / Jonas
Yes we could, it wouldn't be too difficult to reject invocations of `new X` where X is refcounted, and the object isn't passed into a constructor for a refcounted pointer.

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to