Comments: XPCOM Cheat Sheet, first update

In templateComponent.js, the factory is implemented in the same object as the module. According to mconnor/gavin, this will leak. See https://bugzilla.mozilla.org/show_bug.cgi?id=168411#c28

(From Alex: Wow, that's news to me. I need to see how that leak happens. Looking at nsBookmarkTransactionManager.js, the fix is obvious.

I've now fixed this in the online version.)

Posted by jminta at July 23, 2006 9:17 PM

FWIW, /* */ Are not C++ style comments. // are.
Plus, since every file type supports the same comment styles, why not simply put one set of examples ?

(From Alex You are correct, and I have fixed that. Thanks!

As for every file type supporting the same... that's true for the files I mention in the cheat sheet now. However, that may not be true for languages such as Python or Perl, which I believe have XPCOM bindings in progress.)

Posted by glandium at July 23, 2006 11:42 PM

Single line comments (the // style) were added in C++, so you could call _that_ a C++ style comment ;)

Also, you ought to use heading tags for your section headings so that it's easier to see when you've gone from one to the next.

(From Alex: The current version isn't XHTML. So I need to think about that.)

Posted by db48x at July 24, 2006 10:26 PM

hmm, nice cheat sheet. im looking for a hint on how to return an instance of an interface in another interface function.
ie, the result of do_CreateInstance() needs to somehoe be jammed into:
nsIMyComponent ** newInstance

(From Alex: I think you should ask your question in the mozilla.dev.tech.xpcom newsgroup, and with some larger samples of what you're trying to do. :-) )

Posted by donkey at March 28, 2007 9:11 AM

well i'll be a donkey's uncle! my answer was found in the penultimate box at
http://www.mozilla.org/projects/xpcom/book/cxc/html/tools.html

Posted by donkey at March 29, 2007 4:15 AM