Thread overview | |||||
---|---|---|---|---|---|
|
August 19, 2011 core.stdc.stdio.stderr != std.stdio.stderr ? | ||||
---|---|---|---|---|
| ||||
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)* Bye, bearophile |
August 19, 2011 Re: core.stdc.stdio.stderr != std.stdio.stderr ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Fri, 19 Aug 2011 10:12:11 -0400, bearophile <bearophileHUGS@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
|
August 19, 2011 Re: core.stdc.stdio.stderr != std.stdio.stderr ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 8/19/11 4:12 PM, bearophile wrote:
> 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
> }
std.stdio.stderr is a wrapper around core.stdc.stdio.stderr (a D File), you can use std.stdio.stderr.getFP() to get the C FILE pointer from it.
David
|
Copyright © 1999-2021 by the D Language Foundation