Did somebody change the automatic stdout.flush behavior?

Ali Çehreli acehreli at yahoo.com
Thu Feb 17 00:13:24 UTC 2022


In the past, the following program would throw a ConvException *after* 
sending the second message to stdout. Now the second message is not 
displayed at all. Wait! I just checked: The output is actually flushed 
but after the exception output.

import std.stdio;

void main() {
     int a;
     write("Please enter an int: ");
     readf("%s", &a);

     int b;
     write("Please enter another int: ");
     readf("%s", &b);
}

(That is an example to demonstrate the need and usefulness of the space 
character in input format specifiers: Replace "%s" with " %s" and the 
program will work without error.)

I think the current behavior is confusing because the readf error is 
printed *before* stdout is flushed. That's my understanding anyway...

Thank you,
Ali


More information about the Digitalmars-d mailing list