Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Intel corner

#If Target...

Conditional compiling

Issue: 5.3 (March/April 2007)
Author: Christian Schmitz
Article Description: No description available.
Article Length (in bytes): 6,981
Starting Page Number: 44
RBD Number: 5317
Resource File(s): None
Related Link(s): None
Known Limitations: None

Excerpt of article text...

Conditional compiling

Sometimes you have a project which is compiled for more than one platform. But for one of those platforms you want to use special code. Now you can actually keep parts of your code invisible for the compiler if you use #if commands. The compiler will only see what you want it to see and compile.

Let's say you have the following code:

if DebugBuild then

MsgBox "Debug Mode"

else

MsgBox "Compiled application."

end if

The constant DebugBuild is true for your application if you run it inside the IDE. It is false when you build the application. If you compile the code above, the compiler will read the code and place it inside the application. Now compare this to the following code with conditional compiling:

#if DebugBuild then

MsgBox "Debug Mode"

#else

MsgBox "Compiled application."

#endif

In this code you see the difference that there are # before the commands so the compiler knows it is conditional compiling. Note the difference in the "#endif" compared to a normal "end if". The is just one word.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com