Aryeh Gregor wrote:

2) It's easier to use, as evidenced by the patches in bugs 1015114 and 1052477. 
 No .forget() is needed, a raw pointer can be returned directly, even things 
like do_QueryInterface can be returned directly without a temporary nsCOMPtr 
(since the return type creates the temporary for you).  You can just return 
whatever you like and the compiler will figure out if an addref is needed.  
There's a noticeable decrease in LoC when converting to use it.

Do you have to name the temporary nsCOMPtr? For example, in the code
   nsCOMPtr<nsIAtom> atom = GetAtomValue()
   return atom.forget();
Can this be rewritten to
   return nsCOMPtr<nsIAtom>(GetAtomValue()).forget();
Or better still, if this counts as an rvalue, can we define a move constructor from nsCOMPtr<T>&& and write
   return nsCOMPtr<nsIAtom>(GetAtomValue());

--
Warning: May contain traces of nuts.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to