core.stdc.stdio.stderr != std.stdio.stderr ?

Steven Schveighoffer schveiguy at yahoo.com
Fri Aug 19 07:16:10 PDT 2011


On Fri, 19 Aug 2011 10:12:11 -0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Is this all correct?
>
>
> static import core.stdc.stdio;
> static import std.stdio;
> void main() {
>     std.stdio.fprintf(core.stdc.stdio.stderr, "Error\n"); // OK
>     std.stdio.fprintf(std.stdio.stderr, "Error\n"); // line 5, error
> }
>
> The latest DMD gives:
>
> test.d(5): Error: function core.stdc.stdio.fprintf (shared(_iobuf)*  
> stream, in const(char*) format,...) is not callable using argument types  
> (File,string)
> test.d(5): Error: cannot implicitly convert expression (stderr) of type  
> File to shared(_iobuf)*

Yes, std.stdio.stderr is a D File struct, whereas core.stdc.stdio.stderr  
is a C FILE * opaque type.

-Steve


More information about the Digitalmars-d-learn mailing list