About Preprocessing

See Also

Preprocessing modifies the code in your source files before the code is parsed by the compiler. The preprocessor modifies the code according to preprocessor directives inserted as code blocks into the code. These code blocks are marked visually in the Source Editor and are included (or excluded) when you build the JAR for a specific project configuration or ability. You can use these code blocks to create, manage and track code that is specific to one or more project configurations or abilities.

For example, if you are writing an application targeted for several different devices, you can create a project configuration for each device, then create a preprocessor block with directives for each project configuration. You can then test the application for each device quickly by changing the active project configuration and running the application.

This If/Else code block in the following example uses the directives #if, #else, and #endif to create a conditional timeout alarm. If the active configuration is DefaultGrayPhone, the ALERT_TIMEOUT is set for 2000. If the active configuration is set to any other project configuration, the ALERT_TIMEOUT is set to 3000. To test the application for either timeout, you can simply change the default configuration from DefaultGrayPhone to any other configuration.

See Also
Managing Preprocessor Blocks
Working with Project Configurations
About Project Configurations
About Abilities
About Preprocessor Directives

Legal Notices