Closed Bug 523651 Opened 17 years ago Closed 17 years ago

Add a CallQueryInterface that can work with nsCOMPtr

Categories

(Core :: XPCOM, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

I'm tired of all the casting if I want to QI something with ambiguous nsISupports inheritance.
Attached patch Fix — — Splinter Review
Attachment #407554 - Flags: review?(benjamin)
Comment on attachment 407554 [details] [diff] [review] Fix The static_cast *looks* wrong... I thought static_cast wasn't supposed to run cast operators, which is obviously what's happening here. I'd be happier with a c-style cast here: (DestinationType**) aDestination
Attachment #407554 - Flags: review?(benjamin) → review+
static_cast does do cast operators. Testcase: #include "stdio.h" class A { public: operator int() { return 5; } }; int main() { A a; printf("%d\n", static_cast<int>(a)); } prints 5 over here. I can switch to c-style, though.
I think static_cast is better; less risk of accidentally turning into a reinterpret_cast.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: