In order for this site to work correctly, and for us to improve the site, we need to store a small file (called a cookie) on your computer.
By continuing to use this website, you agree to our cookies and privacy policy.
  
Home page Home page Home page Home page
Pixel
Pixel Header R1 C1 Pixel
Pixel Header R2 C1 Pixel
Pixel Header R3 C1 Pixel
Pixel

QTIPS - Handy Compiler Options

Peter Walsh of Turner Information Systems strikes again with this QTip about pre-compiler directives.

"The R/Basic pre-compiler supports a very useful undocumented feature. It allows conditional compilation, for example:


0001    #define TESTMODE
0002    .....
0003    #ifdef TESTMODE
0004      print variable1
0005      print variable2
0006    #endif

The #define is similar to an equate, but is a directive to the pre-compiler only. Thus the two print statements above will always be executed. However if the #define is commented out, the print statements will be treated similar to comments and will be stripped from the source code before the compiler sees it, and thus will not even appear in the object code. It is great for testing.

The syntax is similar to 'C' pre-compiler directives. However there does not appear to be a #else, but there is a #ifndef (if not defined). This has been tested in Arev 2.12"

Sprezzatura have tested this in version 3.0 as well. In addition to the features described by Peter, the pre-compiler also supports #undefine which permits the unsetting of a flag previously set by #define.

(Volume 4, Issue 6, Page 6)
Pixel
Pixel Footer R1 C1 Pixel
Pixel
Pixel
Pixel