[Issue 12162] writeln(args) and writefln("%s", args) have different semantics with variadic args

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 14 12:44:49 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12162


Jakob Ovrum <jakobovrum at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakobovrum at gmail.com


--- Comment #1 from Jakob Ovrum <jakobovrum at gmail.com> 2014-02-14 12:44:48 PST ---
(In reply to comment #0)
> -----
> import std.stdio;
> 
> void test(T...)(T args)
> {
>     writefln("%s", args);
>     writeln(args);
> }
> 
> void main()
> {
>     test(1, 2, 3, 4);
> }
> -----
> 
> $ dmd test.d
> > 1
> > 1234

Well, what did you expect?

I personally would've expected it to error on the basis of having received too
many arguments (or was that error phased out?), but this behaviour looks
correct to me.

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


More information about the Digitalmars-d-bugs mailing list