If stdout is __gshared, why does this throw / crash?

Marco Leise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 5 16:00:56 PST 2016


Am Sat, 05 Mar 2016 14:18:31 +0000
schrieb Atila Neves <atila.neves at gmail.com>:

> void main() {
>      stdout = File("/dev/null", "w");
>      foreach(t; 1000.iota.parallel) {
>          writeln("Oops");
>      }
> }

First thing I tried:

void main() {
     stdout = File("/dev/null", "w");
     foreach(t; 1000.iota.parallel) {
         stdout.writeln("Oops");
     }
}

That does NOT segfault ... hmm.

-- 
Marco



More information about the Digitalmars-d-learn mailing list