Compile time versioning
Part of VersioningCategory
Description
Shows how to do versioning in files at compile time.
Example
// By Joey Peters // pass -version=free to dmd version(Free) { version = FeatureA; } else { version = FeatureA; version = FeatureB; } void main() { // every version has this. version(FeatureA) { printf("Hello world!"); } // only the non free has this version(FeatureB) { printf("Deluxe!"); } } /* The equivalent of #define CONTRACT would be: version = CONTRACT Though, I must add you should not use capitals like you're used to ;) The equivalent of #ifdef ... #endif is: version(...) { } The equivalent of #ifdef ... #else #endif is: version(...) { } else { } */
Source
| Link | http://www.dsource.org/tutorials/index.php?show_example=117 |
| Edited by | jcc7 |
| Date/Time | Thu Sep 23, 2004 9:30 pm |
