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

Java Development

Reply
Developer
Posts: 263
Registered: ‎05-18-2011
My Device: Curve 9300, BB10 Dev Alpha C, Z10

preprocessors issues

1. Yes, in Eclipse I can define a preprocessor such as 'abc'. When I use it in the code, what will it mean for the compiler?

2. Sometime I saw 'SDK...', 'TOUCH...' preprocessors, they are pre-defined. Where can I see the full list of these pre-defined ones.
--tom
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: preprocessors issues

first, you have to write //preprocess into the first line of the class.

you can use preprocessor tags like this:
//#ifdef VER_5_0_0_AND_ABOVE
//#endif
----------------------------------------------------------
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.
@SimonHain on twitter
Highlighted
Developer
Posts: 263
Registered: ‎05-18-2011
My Device: Curve 9300, BB10 Dev Alpha C, Z10

Re: preprocessors issues

Yes, I know how to use some simple pre-defined preprocesssors in my code (I was them in other sample codes) and how to define a new one.... But my questions are:

 

1. if I define a new tag like 'XYZ' and use this tag in my code:

//#ifdef XYZ

//do some thing

//#else

//do something else

//#endif

What does the compiler do with this when I compile with JRE 4.5 or JRE 5.0?

 

2. I'd like to know all pre-defined tags like 'VER_5_0_0_AND_ABOVE', 'TOUCHSCREEN', 'VERSION_4_2_1' that I can use, where are they? I mean is there any documentation that describes these pre-defined tags and their meanings? Because of without knowing these tags, one can use wrong tags, say they may use 'SDK_VERSION_5_0_0_AND_ABOVE' instead of 'VER_5_0_0_AND_ABOVE'.

--tom
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: preprocessors issues

you add the tags in the build page of the application descriptor.
before you build with a certain OS you have to switch the tags to be used.
----------------------------------------------------------
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.
@SimonHain on twitter