Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-13 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Apr 2015 14:31:40 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > It's not hard to write a CTFE version of writef/writeln/etc., that takes > the format argument at compile-time, since std.format itself is already > CTFE-able. i didn't know that (didn't checked, actually), so i rewro

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-13 Thread biozic via Digitalmars-d-learn
On Sunday, 12 April 2015 at 21:34:21 UTC, H. S. Teoh wrote: On Sun, Apr 12, 2015 at 02:33:03PM +, ketmar via Digitalmars-d-learn wrote: On Sun, 12 Apr 2015 14:18:21 +, JR wrote: > But the compiler has all the pieces of information needed to > see > it's wrong, doesn't it? no, it does

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread H. S. Teoh via Digitalmars-d-learn
On Sun, Apr 12, 2015 at 02:33:03PM +, ketmar via Digitalmars-d-learn wrote: > On Sun, 12 Apr 2015 14:18:21 +, JR wrote: > > > But the compiler has all the pieces of information needed to see > > it's wrong, doesn't it? > > no, it doesn't. compiler doesn't know about `std.format.format` an

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread John Colvin via Digitalmars-d-learn
On Sunday, 12 April 2015 at 14:18:23 UTC, JR wrote: I was chatting with a friend and showed him how printf("%s") printed random memory in C I'm pretty sure modern C compilers will warn about something as obviously wrong as this.

Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Apr 2015 14:18:21 +, JR wrote: > But the compiler has all the pieces of information needed to see it's > wrong, doesn't it? no, it doesn't. compiler doesn't know about `std.format.format` and it's special abilities. while it is possible to add such checks to the compiler, it will

writefln patterns with mismatching compile-time known number of arguments

2015-04-12 Thread JR via Digitalmars-d-learn
I was chatting with a friend and showed him how printf("%s") printed random memory in C, whereas writefln("%s") in D threw an Exception upon execution. It's probably not a completely fair comparison but that's a different topic. I admit to being confused as to why it passed compilation at all