Search code examples
ddmd

Why is readf not returning a value?


According to the documentation, readf is supposed to return a uint. But even this simple example fails to compile:

hello.d

import std.stdio;

void main() {
    int x;
    uint r = readf("%s", &x);    
}

error message:

hello.d(5): Error: expression readf("%s",& x) is void and has no value

Am I missing something here?

I'm using dmd (Digital Mars D) compiler v2.050.


Solution

  • You're missing a new version of DMD. This bug was fixed (silently) in v2.052 (at commit 86a080f).