On Friday 2014-03-07 01:32 +0000, Neil wrote:
> Because of the way GetIID/NS_GET_IID works, it's not very easy to
> get the compiler to tell you when you're doing it wrong. So far I've
> come up with a way to get the linker to do it. I'm trying to get the
> compiler to do it, but the results aren't perfect. However along the
> way I have noticed some common mistakes regarding IIDs.
> 
> The most popular mistake was to include a concrete class in
> NS_IMPL_ISUPPORTS; nsSupportsWeakReference was typical.
> 
> I noticed a couple of places that queried for a concrete class which
> didn't have its own IID, which means that you end up querying for
> the base interface instead.

Does the solution we use for do_QueryFrame work here too, for making
the compiler enforce this?

(See the typedef in NS_DECL_QUERYFRAME_TARGET and the static_assert
in NS_QUERYFRAME_ENTRY (etc.) and in do_QueryFrame::operator Dest*.)

-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)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to