| 1 | = Using versions to store multiple programs in one file = |
---|
| 2 | |
---|
| 3 | ''Part of'' VersioningCategory |
---|
| 4 | |
---|
| 5 | == Description == |
---|
| 6 | |
---|
| 7 | Rather than having multiple programs, just have one that compiles for a variety of settings. |
---|
| 8 | |
---|
| 9 | == Example == |
---|
| 10 | |
---|
| 11 | {{{ |
---|
| 12 | #!d |
---|
| 13 | /* |
---|
| 14 | Version.d - the versioning example. |
---|
| 15 | Written by Ameer Armaly, and in the public domain. |
---|
| 16 | */ |
---|
| 17 | //you can version for different os's like so: |
---|
| 18 | version(linux |
---|
| 19 | { |
---|
| 20 | import std.c.linux.linux; |
---|
| 21 | } |
---|
| 22 | version(Win32) |
---|
| 23 | { |
---|
| 24 | import std.c.windows.windows; |
---|
| 25 | } |
---|
| 26 | //or for different environments |
---|
| 27 | |
---|
| 28 | version(fast) |
---|
| 29 | { |
---|
| 30 | //whatever makes it runf aster |
---|
| 31 | } |
---|
| 32 | version(small) |
---|
| 33 | { |
---|
| 34 | //whatever makes it smaller |
---|
| 35 | } |
---|
| 36 | }}} |
---|
| 37 | |
---|
| 38 | == Source == |
---|
| 39 | |
---|
| 40 | Originally contributed by "Anonymous" on Sun Jul 25, 2004. |
---|
| 41 | |
---|
| 42 | || Link || http://www.dsource.org/tutorials/index.php?show_example=106 || |
---|
| 43 | || Edited by || jcc7 || |
---|
| 44 | || Date/Time || Thu Sep 23, 2004 9:31 pm || |