Re: search of a workaround

2013-02-10 Thread monarch_dodra
On Sunday, 10 February 2013 at 14:41:04 UTC, Namespace wrote: On Sunday, 10 February 2013 at 08:38:23 UTC, monarch_dodra wrote: On Saturday, 9 February 2013 at 22:14:45 UTC, Namespace wrote: Why isn't there 'const' in ParameterStorageClass? How could I detect that my Parameter storage class is

Re: D timer

2013-02-10 Thread David
Am 10.02.2013 15:49, schrieb SaltySugar: > Can i do my own timer in D console application? > like in C# timer_Tick event. Not sure what you mean, but I have a pretty solid Timer implementation (Threaded) https://github.com/Dav1dde/BraLa/blob/master/brala/utils/thread.d The file has no dependenci

Re: Missing attributes in FunctionAttribute

2013-02-10 Thread Dicebot
On Sunday, 10 February 2013 at 19:51:36 UTC, Andrej Mitrovic wrote: On 2/10/13, Dicebot wrote: Which part? Probably it refers to delegates, because it has both type qualifiers and attribute that qualifies hidden context pointer. Could be. Anyway it's here: http://dlang.org/declaration.html#

Re: double[][] to double**

2013-02-10 Thread Ali Çehreli
On 02/10/2013 12:05 PM, Danny Arends wrote: Thanks so much ! Why is this not easy 2 find :P We all know the feeling. :) For future reference: The spec: http://dlang.org/arrays.html#array-properties TDPL: 4.6 Arrays' Maverick Cousin: The Pointer Programming in D: http://ddili.org/d

Re: double[][] to double**

2013-02-10 Thread Danny Arends
Thanks so much ! Why is this not easy 2 find :P

Re: double[][] to double**

2013-02-10 Thread Ali Çehreli
On 02/10/2013 11:38 AM, Danny Arends wrote: > I need to call some C code which takes a double** > > In D I have a dynamic array X, Whats a good way of doing this ? > > #SNIP > > extern(C){ > void toCall(double** X, size_t d1, size_t d2); > } > > void main(){ > double[][] X; > > // How to be able t

double[][] to double**

2013-02-10 Thread Danny Arends
I need to call some C code which takes a double** In D I have a dynamic array X, Whats a good way of doing this ? #SNIP extern(C){ void toCall(double** X, size_t d1, size_t d2); } void main(){ double[][] X; // How to be able to: toCall(X, X.length, X[0].length); } #/SNIP Danny Arend

Re: Missing attributes in FunctionAttribute

2013-02-10 Thread Dicebot
On Sunday, 10 February 2013 at 18:25:25 UTC, Andrej Mitrovic wrote: On 2/10/13, Dicebot wrote: On Sunday, 10 February 2013 at 12:29:46 UTC, Namespace wrote: Before I open a new bug report, I would like to ask if anyone knows why FunctionAttribute neither has const, immutable, shared or inout?

Re: Missing attributes in FunctionAttribute

2013-02-10 Thread Andrej Mitrovic
On 2/10/13, Dicebot wrote: > On Sunday, 10 February 2013 at 12:29:46 UTC, Namespace wrote: >> Before I open a new bug report, I would like to ask if anyone >> knows why FunctionAttribute neither has const, immutable, >> shared or inout? >> Especially const and immutable were important to know. > >

Re: Missing attributes in FunctionAttribute

2013-02-10 Thread Dicebot
On Sunday, 10 February 2013 at 12:29:46 UTC, Namespace wrote: Before I open a new bug report, I would like to ask if anyone knows why FunctionAttribute neither has const, immutable, shared or inout? Especially const and immutable were important to know. Well, technically, those are not functi

Re: Creating an array of default-constructed class instances

2013-02-10 Thread Ali Çehreli
On 02/10/2013 03:18 AM, monarch_dodra wrote: > On Sunday, 10 February 2013 at 09:48:04 UTC, Jos van Uden wrote: >> auto things = new Thing[10]; >> fill(things, new Thing(5)); > What you did just right there is allocate a *single* thing _instance_ > and then place 10 _references_ to that same thi

Re: D timer

2013-02-10 Thread rumbu
On Sunday, 10 February 2013 at 14:49:15 UTC, SaltySugar wrote: Can i do my own timer in D console application? like in C# timer_Tick event. There is no Timer in D as you know it from C# and also there are no events. You must rely on SetTimer WinAPI and write your own TimerProc.

Re: search of a workaround

2013-02-10 Thread Namespace
On Sunday, 10 February 2013 at 08:38:23 UTC, monarch_dodra wrote: On Saturday, 9 February 2013 at 22:14:45 UTC, Namespace wrote: Why isn't there 'const' in ParameterStorageClass? How could I detect that my Parameter storage class is 'in'? It's an ambiguity in the term "StorageClass" in D, whic

Re: Invisible console

2013-02-10 Thread Adam D. Ruppe
On Sunday, 10 February 2013 at 14:17:14 UTC, SaltySugar wrote: how to make console invisible? See this thread for two solutions: http://forum.dlang.org/thread/xkvdpdsfzevanucrg...@forum.dlang.org You can use a .def file (my post in it) or a linker switch (Jordi Sayol's post).

Re: Invisible console

2013-02-10 Thread FG
On 2013-02-10 15:17, SaltySugar wrote: how to make console invisible? Seems to be a recurring question here. :) Search archives. You probably want: dmd.exe -L/SUBSYSTEM:WINDOWS app.d

Re: For DLLs, what does export actually do?

2013-02-10 Thread Ben Davis
On 10/02/2013 14:11, Ben Davis wrote: Which would imply the bug was fixed at some point. ...though of course it would need verifying with the example actually quoted in the bug, since there may be subtle differences. (Hopefully I'm just stating the obvious.)

Re: For DLLs, what does export actually do?

2013-02-10 Thread Ben Davis
On 10/02/2013 12:39, Benjamin Thaut wrote: Am 10.02.2013 13:36, schrieb Ben Davis: With the def, I get lines like "DriverProc = _DriverProc@20". Without it, I get lines like "_DriverProc@20 = _DriverProc@20". Then you did hit this 3 year old bug: http://d.puremagic.com/issues/show_bug.cgi?id=3

Re: Looking for writing parallel foreach kind of statement for nested for-loops

2013-02-10 Thread Sparsh Mittal
Think again if you need that. Things start getting pretty ugly. :) Yes, it is not at all intuitive. Indeed... Sparsh, any reason you need the calculation to be done on 2d blocks instead of independent slots? For my problem, original answer was fine, since parallel calculations are not at

Re: For DLLs, what does export actually do?

2013-02-10 Thread Benjamin Thaut
Am 10.02.2013 13:36, schrieb Ben Davis: With the def, I get lines like "DriverProc = _DriverProc@20". Without it, I get lines like "_DriverProc@20 = _DriverProc@20". Then you did hit this 3 year old bug: http://d.puremagic.com/issues/show_bug.cgi?id=3956

Re: For DLLs, what does export actually do?

2013-02-10 Thread Ben Davis
On 10/02/2013 08:17, Benjamin Thaut wrote: Am 10.02.2013 03:03, schrieb Ben Davis: My functions are "export extern (Windows)" - I think they're global...? For example: export extern(Windows) LRESULT DriverProc(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, LONG lParam1, LONG lParam2) nothrow {

Missing attributes in FunctionAttribute

2013-02-10 Thread Namespace
Before I open a new bug report, I would like to ask if anyone knows why FunctionAttribute neither has const, immutable, shared or inout? Especially const and immutable were important to know.

Re: Creating an array of default-constructed class instances

2013-02-10 Thread monarch_dodra
On Sunday, 10 February 2013 at 06:14:37 UTC, Simon wrote: Hi, I'm new to the D programming language. Overall I'm liking things very much, but I'm still getting the hang of a few things. Here's a basic programming pattern: I have a class called Thing, and while I'm coding I decide I need N Thi

Re: Creating an array of default-constructed class instances

2013-02-10 Thread monarch_dodra
On Sunday, 10 February 2013 at 09:48:04 UTC, Jos van Uden wrote: On 10-2-2013 7:14, Simon wrote: Hi, I'm new to the D programming language. Overall I'm liking things very much, but I'm still getting the hang of a few things. Here's a basic programming pattern: I have a class called Thing,

Re: search of a workaround

2013-02-10 Thread Namespace
Well, I did mention "Also, I didn't code the FunctionAttribute part, but that's just because it's late and I want to sleep". I even left a big "todo" in there :) I've overlooked that. :) Here is the complete code. If you have to improve something, say it please. One last question: why 'ss' a

Re: Creating an array of default-constructed class instances

2013-02-10 Thread Jos van Uden
On 10-2-2013 7:14, Simon wrote: Hi, I'm new to the D programming language. Overall I'm liking things very much, but I'm still getting the hang of a few things. Here's a basic programming pattern: I have a class called Thing, and while I'm coding I decide I need N Thing instances. In C++ that's

Re: search of a workaround

2013-02-10 Thread monarch_dodra
On Saturday, 9 February 2013 at 22:14:45 UTC, Namespace wrote: Why isn't there 'const' in ParameterStorageClass? How could I detect that my Parameter storage class is 'in'? It's an ambiguity in the term "StorageClass" in D, which is different from "TypeQualifier". Const is part of the type. "

Re: For DLLs, what does export actually do?

2013-02-10 Thread Benjamin Thaut
Am 10.02.2013 03:03, schrieb Ben Davis: My functions are "export extern (Windows)" - I think they're global...? For example: export extern(Windows) LRESULT DriverProc(DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, LONG lParam1, LONG lParam2) nothrow { ... } Do you have a copy of visual studio

Re: Creating an array of default-constructed class instances

2013-02-10 Thread Philippe Sigaud
On Sun, Feb 10, 2013 at 8:40 AM, Simon wrote: >> auto things = iota(10).map!(i => new Thing(i)).array; >> >> Ali > > > It's a shame there isn't any simple syntax for it, but that's some neat and > flexible code. Oh, you can easily use a template: import std.array; import std.algorithm; impo

Re: Looking for writing parallel foreach kind of statement for nested for-loops

2013-02-10 Thread Philippe Sigaud
On Sun, Feb 10, 2013 at 8:45 AM, FG wrote: > On 2013-02-10 02:22, Sparsh Mittal wrote: >> >> The current reply answers my question, but I was just curious. Can we have >> a >> method which divides the 2d region as follows: 8*12 divided into 4*6 to >> each of >> 4 threads. > > > Think again if you