no release-only version?
    bearophile 
    bearophileHUGS at lycos.com
       
    Fri Mar  7 15:17:58 PST 2008
    
    
  
Bill Baxter Wrote:
> Am I right in thinking there's no built-in way to specify a block of 
> code that gets disabled only in -release builds?
Days ago I was looking for the same thing.
At run time it's possible to know what you ask for (doesn't work in D 2.x, tan(0.9) is run in compile time, I presume):
import std.stdio: writefln;
import std.math: tan;
void main() {
    bool release_mode = true;
    try {
        int[1] a;
        int el = a[ cast(int)tan(0.9) ];
    }
    catch (Error e) {
        release_mode = false;
    }
    writefln(release_mode);
}
But you can't use it in a static if.
Bye,
bearophile
    
    
More information about the Digitalmars-d-learn
mailing list