Re: Compiler bug ?

2013-06-09 Thread Juan Manuel Cabo
On Sunday, 9 June 2013 at 13:37:45 UTC, Temtaime wrote: Hello guys! It seems that it is bug. And critical for me. http://dpaste.1azy.net/b93f5776 Regards. I don't know whether it's a bug, but I managed to reduce the error to the following code (removing __traits code): import std.stdio;

Re: Problem with object understanding and datatypes

2013-05-24 Thread Juan Manuel Cabo
On Saturday, 25 May 2013 at 01:03:53 UTC, Namal wrote: 255 - 129 is less than 128 so the result is T.max, which is 255, which is not equal to 0. I dont understand this at all 255 - 129 should be 126 in ubyte or not? I checked, and operation between two ubyte is an int. When you cast that

Re: What sync object should i use?

2013-05-15 Thread Juan Manuel Cabo
On Wednesday, 15 May 2013 at 02:25:02 UTC, Heinz wrote: I have this "main loop" wich is named here as my consumer function. I didn't want this main loop to be cycling all the time if there was nothing to do. So i needed an event object (condition/mutex) that locked the loop until any of t

Re: What sync object should i use?

2013-05-14 Thread Juan Manuel Cabo
On Tuesday, 14 May 2013 at 17:59:55 UTC, Heinz wrote: Guys, this is a precise example of what i'm trying to do. You'll notice that there're 2 ways of waking up the consumer: / Condition cond; // Previously instantiated. bool lo

Re: how to instantiate explicitly template parameters in struct A(T1){this(T2)(){...}}

2013-05-13 Thread Juan Manuel Cabo
On Tuesday, 14 May 2013 at 03:34:52 UTC, Timothee Cour wrote: A) The behavior of __ctor (whether or not documented) seems broken / unreliable: struct A{this(T)(T x){}} void fun(T){ auto a=A.__ctor!(int)(1); } void main(){ auto a=A.__ctor!(int)(1); //ok fun!int(); //Error: type A is not

Re: What sync object should i use?

2013-05-13 Thread Juan Manuel Cabo
On Monday, 13 May 2013 at 21:55:45 UTC, Steven Schveighoffer wrote: On Mon, 13 May 2013 17:04:22 -0400, Juan Manuel Cabo wrote: I seem to recall (though I might be wrong) that win32 events can be signalled before the thread calls WaitForSingleObject (or WaitForMultipleObjects), and if it

Re: What sync object should i use?

2013-05-13 Thread Juan Manuel Cabo
On Monday, 13 May 2013 at 20:44:37 UTC, Heinz wrote: Ok, here's a summary in case someone else is in the same need: 1) Want to know what "mutex/condition" are, how do they work and when to use them? Here's a good resource: http://stackoverflow.com/a/4742236 2) If you come to the question "Wh

Re: Tricky code with exceptions

2013-05-09 Thread Juan Manuel Cabo
On Friday, 10 May 2013 at 01:05:39 UTC, Juan Manuel Cabo wrote: Then, tested on Windows XP SP3 32 bits, dmd 2.062, and it DIDN'T CRASH. The output is: Mm, sorry!!, it did crash but I had dr watson disabled in that VM. Confirmed adding a writeln("finished") after the foreac

Re: Tricky code with exceptions

2013-05-09 Thread Juan Manuel Cabo
Tested on Linux - Kubuntu 12.04 64bits dmd 2.058 -m32 dmd 2.058 64 bits dmd 2.062 -m32 dmd 2.062 and the output is this for all of the above: Loop: 0 Loop: 1 Caught Loop: 2 Loop: 3 Caught Loop: 4 Loop: 5 Caught Then, tested on Windows X

Re: Deallocate array?

2013-05-07 Thread Juan Manuel Cabo
I found this problem with a program that reads a large xml file (25+ lines), then stores the lines in a string[], does a comparison with another array and finally clears the original array. On the second or third file I always get an OutOfMemoryError, when the Task Manager shows about 1.3GB

Re: Deallocate array?

2013-05-07 Thread Juan Manuel Cabo
Why isn't the memory deallocating? The memory might be free, but still not released to the OS. Especially in windows, when you free memory it still isn't freed from your process. But you can reuse it in your program if the GC has collected it. The correct test would be to copy and paste the