<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Macro inside macro: Q_DECLARE_METATYPE]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I noticed that the Q_DECLARE_METATYPE macro contains another macro in this line:</p>
<p dir="auto">@static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); @</p>
<p dir="auto">How is Q_BASIC_ATOMIC_INITIALIZER expanded inside this macro? I thought you couldn't use a macro inside another macro.</p>
<p dir="auto">I'm asking because I register types in my program using my own macro, and it'd be helpful if I could register the type to Qt at the same time. Right now, I call both MY_TYPE_REGISTER_MACRO(MyClass) and Q_DECLARE_METATYPE(MyClass) in my program.</p>
]]></description><link>https://forum.qt.io/topic/35667/macro-inside-macro-q_declare_metatype</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 15:37:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/35667.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Dec 2013 03:33:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Macro inside macro: Q_DECLARE_METATYPE on Thu, 19 Dec 2013 11:38:46 GMT]]></title><description><![CDATA[<p dir="auto">Hmm... You're right, I must have done something wrong when I tried to include Q_DECLARE_METATYPE in my macro.</p>
<p dir="auto">It's funny (well, not really :)) how you can program for years and still miss basic stuff like this. It even says in one of the docs you linked to (thanks for that!) " <em>Recall that all macro definitions are rescanned for more macros to replace</em>". For some reason I took for granted that the preprocessor only runs a single scan.</p>
<p dir="auto">Thanks again, if I cant get my modified macro to work I may drop another message. :)</p>
]]></description><link>https://forum.qt.io/post/207944</link><guid isPermaLink="true">https://forum.qt.io/post/207944</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Thu, 19 Dec 2013 11:38:46 GMT</pubDate></item><item><title><![CDATA[Reply to Macro inside macro: Q_DECLARE_METATYPE on Thu, 19 Dec 2013 07:43:49 GMT]]></title><description><![CDATA[<p dir="auto">macros can be nested. Of course there are some "pitfalls":<a href="http://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html#Macro-Pitfalls" target="_blank" rel="noopener noreferrer nofollow ugc">http://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html#Macro-Pitfalls</a>.<br />
Do you receive an error?</p>
]]></description><link>https://forum.qt.io/post/207906</link><guid isPermaLink="true">https://forum.qt.io/post/207906</guid><dc:creator><![CDATA[raven-worx]]></dc:creator><pubDate>Thu, 19 Dec 2013 07:43:49 GMT</pubDate></item></channel></rss>