Clearly Label D1/D2/Tango/Phobos
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Apr 18 16:18:43 PDT 2012
On Thu, Apr 19, 2012 at 12:34:09AM +0200, Paul wrote:
[...]
> As for the example from this site under std.stdio; it should
> compile. It's a simple program. This is the mother site.
>
> A member helped me realize that it needs "import std.stdio;"
>
>
> // test.d
> void main(string args[])
> {
> auto f = File("test.txt", "w"); // open for writing
> f.write("Hello");
> if (args.length > 1)
> {
> auto g = f; // now g and f write to the same file
> // internal reference count is 2
> g.write(", ", args[1]);
> // g exits scope, reference count decreases to 1
> }
> f.writeln("!");
> // f exits scope, reference count falls to zero,
> // underlying FILE* is closed.
> }
This is a documentation bug. Please file an issue in the bugtracker so
that this can be fixed.
All code examples in library documentation should compile without errors
as-is, unless they are incomplete snippets, in which case they should
compile in the intended context with no further modifications. If
something doesn't compile, the documentation is faulty and needs to be
fixed.
T
--
The best way to destroy a cause is to defend it poorly.
More information about the Digitalmars-d-learn
mailing list