writeln() assertion failed in hybrid x64
hane via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Sep 5 00:22:22 PDT 2014
On Thursday, 4 September 2014 at 15:10:22 UTC, Jorge A. S. wrote:
> I'm having an error related to yours: when I call writeln
> function in a closed stdout I will get a segfault message.
> Example:
>
> import std.stdio;
>
> void main() {
> stdout.close();
> write("hello\n");
> }
>
> The code above will crash with segfault buf the following code
> will raise an exception instead:
>
> import std.stdio;
>
> void main() {
> stdout.close();
> stdout.write("hello\n");
> }
>
> In one of the specializations of the write function in the
> std.stdio (the call site that you showed in your post) no check
> for closed stdout (when stdout._p is null) is done. I can't say
> if this is a bug in the write function or the desired behaviour
> (I'm a novice here).
>
With DMD of git master, the latter code seems to raise Exception
(stdio.d(2247): Enforcement failed) instead of segfault.
More information about the Digitalmars-d-learn
mailing list