On Tuesday 2014-08-12 18:15 +0300, Aryeh Gregor wrote: > 1) You can use the return value directly without assigning it to an > nsCOMPtr/nsRefPtr. For instance, pass it to a function that wants a > raw pointer, or compare it against a different value.
I consider this a disadvantage, as I pointed out in my previous post. It removes one of the major safety features of nsCOMPtr. > 4) If the callee already holds a strong reference in a local variable, > it can just return that reference instead of a raw pointer. This > saves an addref/release if the caller puts the result in an nsCOMPtr. > Currently you could do this by returning an already_AddRefed, but > that's annoying because of (1) above, so people don't always do so. How does this save an addref/release? Is the compiler allowed to use move constructors rather than copy constructors when constructing the return value of a function from a local variable in that function? -David -- 𝄞 L. David Baron http://dbaron.org/ 𝄂 𝄢 Mozilla https://www.mozilla.org/ 𝄂 Before I built a wall I'd ask to know What I was walling in or walling out, And to whom I was like to give offense. - Robert Frost, Mending Wall (1914)
signature.asc
Description: Digital signature
_______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform