Temporary silence output (stdout)
Mark Isaacson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat May 10 15:21:22 PDT 2014
On Saturday, 10 May 2014 at 20:24:50 UTC, MarisaLovesUsAll wrote:
> Hi!
> I sometimes got a useless messages in stdout from SDL_Image
> library, and I want to temporary silence it. How do I do?
Consider using either version or debug statements.
If you want the messages to be opt-in, debug statements are quite
useful:
debug(myModule) writeln("Hello world!");
Which will only print when you compile with -debug=myModule
If you want more power than that, version statements can be
useful. First declare (or don't) a specific version (or several):
version = MyVersion;
Then conditionally compile code based on that:
version(MyVersion) {
writeln("Hello World");
}
Note that the compiler declares some versions automatically, such
as version(unittest) when compiling with --unittest.
More information about the Digitalmars-d-learn
mailing list