Preprocessor Identifiers example
The following example demonstrates how you would create code that runs on different versions of dBASE, using the built-in identifiers __dbasewin__, __vdb__ and __version__:
#ifdef __dbasewin__
&& dBASE/Win or Visual dBASE 5.x
#define version str(__dbasewin__,4,2)
#else
#if __vdb__ < 2000
// Visual dBASE 7.x
#define version __vdb__
#else
// dBASE versions after Visual dBASE 7.5
#define version __vdb__+" release "+__version__
#endif
#endif
? "Version: " + version
Because code that is excluded by #if is never compiled, you can safely use new syntax that might be introduced in a new version. When compiled with an older version of dBASE, the new code is ignored. This is different than testing the version returned by the VERSION( ) function at run time. New syntax would not compile under an older version.
Note that for the pre-version 7 code, the older comment style is used.