|QueryInterface()| and macros

RESOLVED FIXED in M15

Status

()

Core
XPCOM
P3
normal
RESOLVED FIXED
19 years ago
13 years ago

People

(Reporter: Bruce Mitchener, Assigned: Bruce Mitchener)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

19 years ago
The more |QueryInterface()| implementations I look at, the more I see that suck
in one way or another.  I need to look at writing a couple of macros to make the
process of writing one easier in the cases that aren't covered by
NS_IMPL_QUERYINTERFACE from nsISupportsUtils.h (and use that macro where
possible as it isn't as widely used in the tree as it could be).
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
Target Milestone: M10

Comment 1

19 years ago
Thanks for filing this one and looking into better/more macros.  But this bug
shouldn't cause just bruce@cybersight.com to sweep up after others.  How about
filing bugs against the individuals whose QI implementations suck, with pointers
to http://www.mozilla.org/projects/xpcom/ docs that show to fix them using your
macros?

cc'ing scc, dp, and warren, who are the first among many XPCOM owners.

/be

Comment 2

19 years ago
I've thought for some time that it would be nice to define a few more flavors
of the NS_IMPL_ISUPPORTS macro. The problem with the current macro is that if
you want to implement more than one interface, you can't use it. It would be
nice to have:

#define NS_IMPL_ISUPPORTS2(clazz, intf1, intf2) ...
#define NS_IMPL_ISUPPORTS3(clazz, intf1, intf2, intf3) ...
...

which would probably take care of 99% of the QI cases, making sure that QI got
done right when the macros were used.
(Assignee)

Comment 3

19 years ago
I had been thinking of doing this ... and then for those where a QI still had to
be manually written, providing a couple of building-block macros, like the part
that compares the IID and does the static cast.

This sound acceptable?  How many variants do we want to provide?  Up to 6
interfaces?  I haven't looked through the tree enough yet to see what classes
might be out there implementing tons of interfaces.

Comment 4

19 years ago
Up to 6 would be good. There are ones that have more than that. But that number
is like five rather than 100. So I think thats ok.

Comment 5

19 years ago
I think if you provided NS_IMPL_ISUPPORTS macros that handled up to 3
interfaces you'd cover most of the cases.

I don't know if I'd add the more complicated building block ones though. In my
experience people don't take the time to learn how to use complicated sets of
macros. If it doesn't do exactly what they want and is completely obvious,
they'll just write it from scratch.
(Assignee)

Updated

19 years ago
Target Milestone: M10 → M15
(Assignee)

Comment 6

19 years ago
I think most of these ended up getting done?  Getting off of beta radar.
(Assignee)

Comment 7

18 years ago
This was done by someone long long ago.
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED

Updated

13 years ago
Component: XP Miscellany → XPCOM
You need to log in before you can comment on or make changes to this bug.