Compiling debug missing errors

Duarte via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 9 13:49:42 PDT 2017


Hi all,

Using the following example:

---------------

import std.stdio;

pure void foo()
{
     debug
     {
         stdout.writeln("1");
     }

     stdout.writeln("2");
}

void main(string[] args)
{
     foo();
}

---------------

Using either '-debug' or '-release', the second stdout will give 
an error (Error: pure function 'main.foo' cannot access mutable 
static data 'stdout') which is alright by me.

The question is why the first stdout doesn't throw the same error 
when compiling with the '-debug' option? Surely the issue will be 
the same and the debug-statement should be satisfied.


Ĝis,
Duarte


More information about the Digitalmars-d-learn mailing list