www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10139] New: writef does not behave according to documentation

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10139

           Summary: writef does not behave according to documentation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: gdkslpmq spam4.me



According to the std.stdio page on the D website, the behaviour of writef
should be:

"If the first argument args[0] is a FILE*, use the format specifier in args[1]
to control the formatting of args[2..$], and write the resulting string to
args[0]. If arg[0] is not a FILE*, the call is equivalent to writef(stdout,
args)."

However, this program

import std.stdio;
void main() {
        writef(stderr.getFP(), "hi");
}

fails to compile with the error

/usr/include/d/std/stdio.d(1756): Error: template std.stdio.File.writef does
not match any function template declaration. Candidates are:
/usr/include/d/std/stdio.d(752):        std.stdio.File.writef(Char, A...)(in
Char[] fmt, A args)
/usr/include/d/std/stdio.d(1756): Error: template std.stdio.File.writef(Char,
A...)(in Char[] fmt, A args) cannot deduce template function from argument
types !()(shared(_iobuf)*,string)
test.d(5): Error: template instance std.stdio.writef!(shared(_iobuf)*,string)
error instantiating
z

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10139


Steven Schveighoffer <schveiguy yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy yahoo.com
            Summary|writef does not behave      |std.stdio.writef and
                   |according to documentation  |friends documentation is
                   |                            |severely out of date



20:22:05 PDT ---
The docs are wrong.  They need updating.

use stderr.writef instead of writef(stderr ...).

global writef is now simply a forwarding call to stdout.writef.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22 2013