01-23-2013 04:50 AM
I am working with the preprocessor directives currently, and was able to use it successfully for my sample application.I am using the Blackberry Java Plugin for Eclipse for my development, and have observed that it provides certain predefined directives for all the JDEs ( I am working with JDE 5.0, 6.0, 7.0 and 7.1) While I understand that each preprocessor can correspond to a single JDE only, I want to use a single preprocessor statement for multiple JDEs.
For example instead of :
//#ifdef BlackBerrySDK6.0.0 setTitle( "HelloBlackBerry 6.0.0" ); //#endif
I want to put a preprocessor that works for JDE 6.0.0 and all JDEs above 6.0.0 :
//#ifdef BlackBerrySDK6.0.0 or BlackBerrySDK7.0.0 or BlackBerrySDK7.1.0 setTitle( "HelloBlackBerry" ); //#endif
In short, can I have logical AND | OR operations amongst the preprocessor directives?
Any help will be highly appreciated!
Solved! Go to Solution.
01-23-2013 05:32 AM
I figured it out, probably using the | and & operators works :
//#ifdef BlackBerrySDK6.0.0 | BlackBerrySDK7.0.0 do something //#endif
Though I am amazed how none of the so many articles on preprocessor directives mentions about this!
01-24-2013 02:52 AM
Has anyone used a combination of & and | operators in a directive?
For example :
//#ifdef myPreprocessor & (BlackBerrySDK7.0.0 | BlackBerrySDK7.1.0)
The compiler gives me an error that a combination of & and | cannot be used with //#if statement..How do I go about achieving this then..