digitalmars.D.learn - Static if on release build
- Fra Mecca (13/13) Oct 19 2017 I can't find any documentation regarding conditional compilation
- bauss (3/16) Oct 19 2017 Take a look at this:
- rikki cattermole (14/28) Oct 19 2017 Well yeah... full doesn't exist[0].
- b4s1l3 (18/31) Oct 19 2017 The most close compile condition is
- Guillaume Piolat (3/16) Oct 21 2017 Note thatwith D compilers -debug and -release are not opposed to
I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else } How can I produce a release version with different parameters from debug using dub and static if's?
Oct 19 2017
On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote:I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else } How can I produce a release version with different parameters from debug using dub and static if's?Take a look at this: https://dlang.org/spec/version.html#DebugCondition
Oct 19 2017
On 20/10/2017 3:36 AM, Fra Mecca wrote:I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else } How can I produce a release version with different parameters from debug using dub and static if's?Well yeah... full doesn't exist[0]. If debug is turned on: debug { } else { } That else isn't for 'release'. Release turns on optimizations in the compiler and disables a few other things like asserts. If you want to specify a version at the command line use ``-version=MyVersion``. For a debug identifier use ``--debug=MyDebug`` and yes, debug conditions can have identifiers like versions require. For dub you can specify it via ``versions`` and ``debugVersions``. [0] https://dlang.org/spec/version.html [1] http://code.dlang.org/package-format?lang=json
Oct 19 2017
On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote:I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else } How can I produce a release version with different parameters from debug using dub and static if's?The most close compile condition is version(assert) { // build for testing } else { // build for release } see https://dlang.org/spec/version.html#predefined-versions: "assert Checks are being emitted for AssertExpressions" And at the same time https://dlang.org/dmd-linux.html#switch-release "compile release version, which means not emitting run-time checks for contracts and asserts. Array bounds checking is not done for system and trusted functions, and assertion failures are undefined behaviour."
Oct 19 2017
On Friday, 20 October 2017 at 02:36:37 UTC, Fra Mecca wrote:I can't find any documentation regarding conditional compilation in release and debug mode. I have read the page regarding the topicon dlang.org but adding the snippet below makes no difference when compiling with dub -b release { version(full) { //do something } else { //do something else } How can I produce a release version with different parameters from debug using dub and static if's?Note thatwith D compilers -debug and -release are not opposed to each other. A program can have both flags, or none.
Oct 21 2017