On Tue, Aug 12, 2014 at 7:12 PM, Vladimir Vukicevic <vladi...@pobox.com> wrote:
> It's unfortunate that we can't create a nsCOMPtr<> that will disallow 
> assignment to a bare pointer without an explicit .get(), but will still allow 
> conversion to a bare pointer for arg passing purposes.  (Or can we? I admit 
> my C++-fu is not that strong in this area...)

We could do this if we instituted a new type and mandated that type be
used instead of raw pointers for local variables.  Call it
RawPointer<T> or something.  Using raw pointers like this is still
inherently dangerous for nontrivial code -- including code that's
subsequently changed to be nontrivial -- but if this bit of extra
safety is important, it would be possible to get it this way.

Of course, then review would have to check that RawPointer<T> is used
instead of T*, unless we can get static analysis to do it.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to