On 3/26/2013 10:16 AM, Neil wrote:
Why does getter_AddRefs<T> have an operator nsISupports**? So far most
of the uses I've found appear to be people enumerating an
nsISimpleEnumerator directly into an nsCOMPtr<T> type, although the
documented idl return value is nsISupports. Is this an acceptable
paradigm?
No, I'll assert that it is not acceptable. If you're going to make
assumptions about the types coming out of a nsISimpleEnumerator, you
should at least have to write a static_cast<> so that the assumption is
explicit. And unless both pieces of code are in C++, it's unlikely that
this code would be correct and the static_cast is usually not safe.
I think I tried to remove the nsISupports** operator before and ran into
trouble with some weird edge cases, but I fully support us trying to do
it again. For things like QI result, the void** operator is the correct
one anyway.
--BDS
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform