On Tuesday 10 July 2012 18:37:20 Marc Mutz wrote: > Hi, > > as seen on IRC: > [18:18:43] <ossi|tt> thiago: how about we make Q_DECLARE_TYPEINFO > automatically use the qt namespace, like Q_DECLARE_METATYPE does? it is > massively SIC, except that probably not many outside qt/creator use it ... > [18:20:09] <marc_kdab_> ossi|tt: errhm, I used it in many projects, and the > Q_DECLARE_METATYPE solution is also not the best one > [18:20:22] <marc_kdab_> though I'm all for consistency, too > [18:20:34] <ossi|tt> marc_kdab_: but you probably didn't use qt in > namespace? [18:21:08] <marc_kdab_> could someone with VS 2005 and/or 2008 > please test-drive https://codereview.qt-project.org/#/t/35/ ? > [18:21:42] <marc_kdab_> ossi|tt: I made KDTools work with a namespaced Qt, > and hit the problem of Q_DECLARE_TYPEINFO there > [18:22:23] <ossi|tt> marc_kdab_: yeah. i'd instantly change it. not sure > about the amount of opposition to expect, though > [18:22:50] <marc_kdab_> ossi|tt: the question is: change which way? > [18:23:26] <ossi|tt> marc_kdab_: have it in the namespace transparently. > it's insane that user code needs to be aware of this in this context > [18:24:21] <marc_kdab_> ossi|tt: but user code needs to be aware of a > namespaced Qt in any case. Wrapping the QClass forward-declarations was the > most work, and then wrapping Q_DECLARE_TYPEINFO, too, is just consistent > [18:24:47] <marc_kdab_> (wrapping in QT_BEGIN_NAMESPACE / > QT_END_NAMESPACE, that is) > [18:25:06] <ossi|tt> marc_kdab_: yes, but it's stupid that i need to wrap a > macro with another macro pair > [18:26:12] <marc_kdab_> ossi|tt: depends how your take is on consistency, I > guess [18:27:42] <marc_kdab_> I don't have an opinion myself; both ways > have pros and cons... [18:27:59] <marc_kdab_> if in doubt, stay with the > status quo, I guess [18:28:06] <ossi|tt> marc_kdab_: this macro is clearly > optimized for the use in qt, where everything is wrapped in these macros > anyway > [18:28:35] <ossi|tt> marc_kdab_: the easiest way out would be > Q_DECLARE_NAMESPACED_TYPEINFO > > As I said, I'm undecided. On one hand, I always have to look at the > implementation to see whether I need to wrap the macro in > QT_BEGIN_NAMESPACE / > QT_END_NAMESPACE, and I would like to see consistency here, on the other > hand, in a way it's Q_DECLARE_METATYPE that's inconsistent, since it > violates the "put Qt stuff into QT_BEGIN_NAMESPACE if you want to be > compatible with a namespaced Qt, otherwise don't bother" assumption. > > What's the general opinion on this?
My opinion is to fix Q_DECLARE_TYPEINFO to do the same as in Q_DECLATE_METATYPE (as ossi says) It is source incompatible only with namespaced Qt, that are not that common anyway. _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
