Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 151
Registered: ‎09-28-2012
My Device: Blackberry Developer
My Carrier: Aircel
Accepted Solution

Macro Expansion..

what is Macro Expansion ??

 

like..

 

Q_DECL_EXPORT int main(int argc, char **argv)
{

     //code

}

 

Q_DECL_EXPORT is a Macro Expansion,,


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 271
Registered: ‎05-29-2013
My Device: BlackBerry Z10
My Carrier: MTS

Re: Macro Expansion..

It means the real code defined by the macro.

-------------------------------------------------------------------------------
NSR Reader for BlackBerry 10 @NSRReader on Twitter
Me @xelfium on Twitter
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Macro Expansion..

A macro means the same in C/C++ as it does in other forms of content creation be that in a word document or here in the forums when writing responses.

 

Basically it replaces the word defined as a 'macro' with other much longer text and therefore is just a convenience to the writer not to have to type it all out.

 

If you hold your mouse pointer over a macro in Momentics it will let you know what it is expanding it to or in other words replacing it with.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 41
Registered: ‎02-06-2013
My Device: Developer - BB10 Dev B
My Carrier: Rogers

Re: Macro Expansion..

Also note that some of them exist for the sake of the MOC system only, so they actually expand out to nothing (or void, or white space)

Highlighted
Developer
Posts: 1,178
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Macro Expansion..

This is important to note since if you don't realize this you can be pulling your hair out trying to figure out what the Qt macros are expanding to. Q_SIGNALS and "signals:" for instance both expand to "public:" in the C++ preprocessor, but when MOC get's a hold of them they resolve to much more complicated code.

 

I wanted to point out that the answers so far have oversimplified what macros are. The are not just simple text replacement placeholders, they can actually take parameters, which are plugged into the substitution text where you want them. Q_PROPERTY is an example of this since it looks like a function call when you use it. Everything you put inside the parenthesis is a single parameter for the Q_PROPERTY macro, which is parsed by the MOC to build property system code behind your back. In the C++ preprocessor however Q_PROPERTY and all of its parameters expand to nothing.

 


MatthewGeomax wrote:

Also note that some of them exist for the sake of the MOC system only, so they actually expand out to nothing (or void, or white space)






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.
Developer
Posts: 151
Registered: ‎09-28-2012
My Device: Blackberry Developer
My Carrier: Aircel

Re: Macro Expansion..

Thank you every one for your contribution...


----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.