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

Reply
Developer
ankur_siwach
Posts: 142
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.
Please use plain text.
Developer
saprykin
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
Please use plain text.
Developer
BBSJdev
Posts: 6,089
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
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. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
MatthewGeomax
Posts: 39
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)

Please use plain text.
Developer
greenmr
Posts: 874
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.
Please use plain text.
Developer
ankur_siwach
Posts: 142
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.
Please use plain text.