Re: opDollar()

2011-03-26 Thread Jonathan M Davis
On 2011-03-26 01:03, Caligo wrote: In the expression a[expr 1, ..., expr k], if $ occurs in expr i, it is rewritten as a.opDollar!(i)(). -- TDPL, pg 380 Is that correct? if so, could some one give an example code? I don't understand the need for the parameter. Also, what is the

Re: inline functions

2011-03-26 Thread Caligo
On Sat, Mar 26, 2011 at 3:47 AM, Jonathan M Davis jmdavisp...@gmx.com wrote: On 2011-03-26 01:06, Caligo wrote: On Fri, Mar 25, 2011 at 11:56 PM, Jonathan M Davis jmdavisp...@gmx.com wrote: On 2011-03-25 21:21, Caligo wrote: On Fri, Mar 25, 2011 at 10:49 PM, Jonathan M Davis

is(T : long) vs is(T == long)

2011-03-26 Thread Caligo
What is the difference between this: template isNumerik(T){ enum bool isNumerik = is(T : long) || is(T : real); } and this: template isNumerik(T){ enum bool isNumerik = is(T == long) || is(T == real); } They both work and I can't find anywhere in the book where it talks about the :

Re: is(T : long) vs is(T == long)

2011-03-26 Thread Caligo
:-) thanks.

Re: inline functions

2011-03-26 Thread bearophile
Answer for Jonathan M Davis and Caligo: I far as I remember you need to use -finline-functions on GDC to perform inlining. -O3 implies inlining, on GCC, and I presume on GDC too. Inlining is a complex art, the compilers compute a score for each function and each function call and decide if

Re: inline functions

2011-03-26 Thread bearophile
This little test program: struct Vector(T) { T[3] data; T dot(const ref Vector o) { return data[0] * o.data[0] + data[1] * o.data[1] + data[2] * o.data[2]; } T lengthSquaredSlow() { return dot(this); } T lengthSquaredFast()

Re: inline functions

2011-03-26 Thread Caligo
I've changed my code since I posted this, so here is something different that shows performance difference: module t1; struct Vector{ private: double x = void; double y = void; double z = void; public: this(in double x, in double y, in double z){ this.x = x; this.y = y;

Re: inline functions

2011-03-26 Thread bearophile
Caligo: There shouldn't be a performance difference between the two, but there. It seems the compiler isn't removing some useless code (the first has 3 groups of movsd, the second has 4 of them): v = v * 1.0012; main: L45:mov ESI,offset FLAT:_D4test6Vector6__initZ

expression templates

2011-03-26 Thread Mr enuhtac
Hello everyone, I'm new to D and this list (although I've had a look onto D a few years ago). I hope you guys can help me with my questions. At the moment I'm trying to implement some expression template stuff. My first goal is to encode an expression into a type representing that expression

Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-26 Thread nrgyzer
Hey guys, I got Assertion failure: '!vthis-csym' on line 703 in file 'glue.c' after I add LinkList!(uint) myList; to my source file. I figured out that the same bug was already reported on http://lists.puremagic.com/ pipermail/digitalmars-d-bugs/2010-October/019237.html Ticket 4129 describes a

Re: inline functions

2011-03-26 Thread Jérôme M. Berger
bearophile wrote: I have not found a quick way to let GCC vectorize this code, using two multiplications with one SSE instructions, I am not sure GCC is able to do this automatically. Even with -ftree-vectorize? AFAIK it is considered experimental and needs to be turned on

Re: inline functions

2011-03-26 Thread bearophile
Jérôme M. Berger: Even with -ftree-vectorize? Right. AFAIK it is considered experimental and needs to be turned on explicitly. Don't know how good it is though... It's a very long lasting and complex experiment then :-) There is a lot of work behind that little switch. Modern

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-26 Thread bearophile
nrgyzer: In this case I think it makes no sense to post thousand lines of code. I suggest to copy your code, and then keep removing lines from your copy, making sure it keep showing the same compiler error. In some time you will probably be able to produce a small program, fit for this

Re: expression templates

2011-03-26 Thread bearophile
Mr enuhtac: But these workarounds are ugly, if would greatly prefer the normal comparison operators. Does anyone has an idea how to use them? I don't know the answer. If no one will give you a good answer then I suggest you to ask the same question (with the same code example) in the main D

Re: Assertion failure: '!vthis-csym' on line 703 in file 'glue.c'

2011-03-26 Thread David Nadlinger
On 3/26/11 11:08 PM, bearophile wrote: I suggest to copy your code, and then keep removing lines from your copy, making sure it keep showing the same compiler error. In some time you will probably be able to produce a small program, fit for this newsgroup or even for Bugzilla. (There are

How do I limit the number of active threads (queuing spawn calls)

2011-03-26 Thread Andrej Mitovic
I'm testing out some various compilation schemes with DMD. Right now I'm spawning multiple threads which simply do a `system` call with a string like DMD -c somefile.d. I'd like to limit the number of active threads to something my CPU can handle (4 in this case since I've got 4 cores..). How

Re: How do I limit the number of active threads (queuing spawn calls)

2011-03-26 Thread Jonathan M Davis
On 2011-03-26 18:15, Andrej Mitovic wrote: I'm testing out some various compilation schemes with DMD. Right now I'm spawning multiple threads which simply do a `system` call with a string like DMD -c somefile.d. I'd like to limit the number of active threads to something my CPU can handle (4

Re: How do I limit the number of active threads (queuing spawn calls)

2011-03-26 Thread Andrej Mitrovic
Well I've worked around this by polling a variable which holds the number of active threads. It's not a pretty solution, and I'd probably be best with using std.parallelism or some upcoming module. My solution for now is: import std.stdio; import std.file; import std.path; import std.process;

Re: How do I limit the number of active threads (queuing spawn calls)

2011-03-26 Thread Andrej Mitrovic
Edit: It looks like I did almost the same as Jonathan advised. I'm looking forward to std.parallelism though. I'm thinking I'd probably use some kind of parallel foreach loop that iterates over 4 files at once, and letting it do its work by spawning 4 threads. Or something like that. We'll see.

Re: How do I limit the number of active threads (queuing spawn calls)

2011-03-26 Thread Brad Roberts
On 3/26/2011 7:00 PM, Andrej Mitrovic wrote: Edit: It looks like I did almost the same as Jonathan advised. I'm looking forward to std.parallelism though. I'm thinking I'd probably use some kind of parallel foreach loop that iterates over 4 files at once, and letting it do its work by