Re: Translation of C function pointer.

2010-09-17 Thread Jonathan M Davis
On Friday, September 17, 2010 17:07:15 Simen kjaeraas wrote: > Jonathan M Davis wrote: > >> I've always been confused by C in this regard. It seems to logical to me > >> that T[3] works the same whether T is U[4] or U. > > > > You're going to have to elaborate on that. I'm not quite sure what you

Re: Translation of C function pointer.

2010-09-17 Thread Simen kjaeraas
Jonathan M Davis wrote: I've always been confused by C in this regard. It seems to logical to me that T[3] works the same whether T is U[4] or U. You're going to have to elaborate on that. I'm not quite sure what you're talking about. And the syntax int[4][3] isn't legal C anyway. It just d

Re: Function with default parameters

2010-09-17 Thread Simen kjaeraas
Mariusz Gliwiński wrote: Why it isn't allowed? Implementing that would be just about checking if all required parameters are filled and make something with parameter name / local function variable conflict. It would be nice a little nice thing... Many of us have lobbied for that feature.

Re: Function with default parameters

2010-09-17 Thread Mariusz Gliwiński
On 2010-09-18 00:40, Steven Schveighoffer wrote: On Fri, 17 Sep 2010 18:37:09 -0400, Mariusz Gliwiński wrote: Basically picking just right parameter while other have default. But now I can't find syntax anywhere. This code didn't worked, could you refresh my memory? D parameters don't work th

Re: Function with default parameters

2010-09-17 Thread Steven Schveighoffer
On Fri, 17 Sep 2010 18:37:09 -0400, Mariusz Gliwiński wrote: I just could promise I've seen in D2 something like in scripting languages: module test; void main (string[] args) { test(b = "test"); } void test(string a = "a", string b = "b", string c = "c") { } Basically picking jus

Function with default parameters

2010-09-17 Thread Mariusz Gliwiński
I just could promise I've seen in D2 something like in scripting languages: module test; void main (string[] args) { test(b = "test"); } void test(string a = "a", string b = "b", string c = "c") { } Basically picking just right parameter while other have default. But now I can't find syn

Re: importing std.algorithm breaks std.string.count

2010-09-17 Thread Seth Hoenig
Submitted *Issue 4883 * On Fri, Sep 17, 2010 at 4:30 PM, Steven Schveighoffer wrote: > On Fri, 17 Sep 2010 17:15:31 -0400, Seth Hoenig > wrote: > > I have these two minimal programs: >> >> >> import std.string; >> void main() >> { >>stri

Re: importing std.algorithm breaks std.string.count

2010-09-17 Thread Steven Schveighoffer
On Fri, 17 Sep 2010 17:15:31 -0400, Seth Hoenig wrote: I have these two minimal programs: import std.string; void main() { string str = "abc"; int i = str.count("ab"); } and: import std.string; import std.algorithm; void main() { string str = "abc"; int i = str.count(

importing std.algorithm breaks std.string.count

2010-09-17 Thread Seth Hoenig
I have these two minimal programs: import std.string; void main() { string str = "abc"; int i = str.count("ab"); } and: import std.string; import std.algorithm; void main() { string str = "abc"; int i = str.count("ab"); } The only difference is line 2, where I import st

readf bug in the std.stdio

2010-09-17 Thread Can Alpay Çiftçi
Code: import std.stdio; void main() { char a; wchar b; dchar c; readf("%s %s %s", &a,&b,&c); } Error : dmd -w -c "isimsiz.d" (C:\Program Files\Geany ) C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(441): Error: template std.format.unformatValue(T,Range,Char) if (

Re: Translation of C function pointer.

2010-09-17 Thread Jesse Phillips
Jonathan M Davis Wrote: > On Friday, September 17, 2010 10:43:12 Ali Çehreli wrote: > > > > int[4] is an array of 4 ints; like Simen, let's call it U. > > Now U[3] is an array of 3 Us; i.e. 3 int[4]s > > > > I read that from left to right, not inside out. > > No, no. You read it outwards from t

Re: Translation of C function pointer.

2010-09-17 Thread Jonathan M Davis
On Friday, September 17, 2010 10:43:12 Ali Çehreli wrote: > Jonathan M Davis wrote: > > On Thursday 16 September 2010 23:50:16 Kagamin wrote: > >> BCS Wrote: > >>> The trick is that function pointers are best read from the inside out. > >> > >> All C declarations are read from inside out, pos

Re: Translation of C function pointer.

2010-09-17 Thread Jonathan M Davis
On Friday, September 17, 2010 05:00:55 Simen kjaeraas wrote: > On Fri, 17 Sep 2010 10:12:34 +0200, Jonathan M Davis > > wrote: > > On Thursday 16 September 2010 23:50:16 Kagamin wrote: > >> BCS Wrote: > >> > The trick is that function pointers are best read from the inside out. > >> > >> All C d

Re: Translation of C function pointer.

2010-09-17 Thread Ali Çehreli
Jonathan M Davis wrote: > On Thursday 16 September 2010 23:50:16 Kagamin wrote: >> BCS Wrote: >>> The trick is that function pointers are best read from the inside out. >> All C declarations are read from inside out, postfixes take precedence, >> that's why you have to use braces to give pointer h

Re: FIle I/O

2010-09-17 Thread Jonathan M Davis
On Friday, September 17, 2010 09:21:07 Graham Nicholls wrote: > I'm getting a little confused. I've installed a .deb package of d 2.0, but > now my code won't compile: > unlogcat.d(112): Error: std.stream.File at > /usr/include/d/dmd/phobos/std/stream.d(1787) conflicts with std.stdio.File > at /us

Re: FIle I/O

2010-09-17 Thread Steven Schveighoffer
On Fri, 17 Sep 2010 12:21:07 -0400, Graham Nicholls wrote: I'm getting a little confused. I've installed a .deb package of d 2.0, but now my code won't compile: unlogcat.d(112): Error: std.stream.File at /usr/include/d/dmd/phobos/std/stream.d(1787) conflicts with std.stdio.File at /usr/

Re: FIle I/O

2010-09-17 Thread Graham Nicholls
I'm getting a little confused. I've installed a .deb package of d 2.0, but now my code won't compile: unlogcat.d(112): Error: std.stream.File at /usr/include/d/dmd/phobos/std/stream.d(1787) conflicts with std.stdio.File at /usr/include/d/dmd/phobos/std/stdio.d(248) Yet if I leave either out, I g

Re: Translation of C function pointer.

2010-09-17 Thread Simen kjaeraas
On Fri, 17 Sep 2010 10:12:34 +0200, Jonathan M Davis wrote: On Thursday 16 September 2010 23:50:16 Kagamin wrote: BCS Wrote: > The trick is that function pointers are best read from the inside out. All C declarations are read from inside out, postfixes take precedence, that's why you have t

Re: Translation of C function pointer.

2010-09-17 Thread Jonathan M Davis
On Thursday 16 September 2010 23:50:16 Kagamin wrote: > BCS Wrote: > > The trick is that function pointers are best read from the inside out. > > All C declarations are read from inside out, postfixes take precedence, > that's why you have to use braces to give pointer higher precedence. One > of