Re: Loop optimization

2010-05-15 Thread Don
bearophile wrote: kai: Any ideas? Am I somehow not hitting a vital compiler optimization? DMD compiler doesn't perform many optimizations, especially on floating point computations. More precisely: In terms of optimizations performed, DMD isn't too far behind gcc. But it performs almost

Re: Loop optimization

2010-05-15 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jérôme M. Berger wrote: That depends. In C/C++, the default value for any global variable is to have all bits set to 0 whatever that means for the actual data type. No it's not, it's always uninitialized. Visual studio will initialise

Re: Loop optimization

2010-05-15 Thread Jérôme M. Berger
div0 wrote: Jérôme M. Berger wrote: That depends. In C/C++, the default value for any global variable is to have all bits set to 0 whatever that means for the actual data type. No it's not, it's always uninitialized. According to the C89 standard and onwards it *must* be

Re: compiled gdb

2010-05-15 Thread eles
maybe it could be even integrated in the dmd archive, just like the windbg currently is...

c function as parameter

2010-05-15 Thread useo6
Hello everyone, I'm trying to create a function which awaits a C function as parameter... like this: void myfunction(void C function(uint, void*)) { } But... when I try to compile it, I get the follwing error: found 'function' when expecting ')'. Does anyone knwo what's wrong with my

Re: c function as parameter

2010-05-15 Thread useo6
useo6 Wrote: Hello everyone, I'm trying to create a function which awaits a C function as parameter... like this: void myfunction(void C function(uint, void*)) { } But... when I try to compile it, I get the follwing error: found 'function' when expecting ')'. Does anyone knwo

Re: c function as parameter

2010-05-15 Thread Simen kjaeraas
useo6 us...@start.bg wrote: Hello everyone, I'm trying to create a function which awaits a C function as parameter... like this: void myfunction(void C function(uint, void*)) { } But... when I try to compile it, I get the follwing error: found 'function' when expecting ')'. Does

Re: c function as parameter

2010-05-15 Thread useo6
Simen kjaeraas Wrote: useo6 us...@start.bg wrote: Hello everyone, I'm trying to create a function which awaits a C function as parameter... like this: void myfunction(void C function(uint, void*)) { } But... when I try to compile it, I get the follwing error: found

Re: Loop optimization

2010-05-15 Thread Don
strtr wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article But the bigger problem in your code is that you are performing operations on NaNs (that's the default initalization of FP values in D), and operations on NaNs are usually quite slower. I didn't know that. Is it the

Three legitimate bugs? (D1.061)

2010-05-15 Thread strtr
Should I report these bugs? (and how should I call this first one?) module main; //const S S1 = S(); // uncomment this to compile struct S { float value; static S opCall() { S s; return s; } const S S2 = S(); } void main(){} -- main.d(4): Error: struct main.S no size yet for

Re: Three legitimate bugs? (D1.061)

2010-05-15 Thread bearophile
strtr Wrote: Should I report these bugs? Yes, add them to bugzilla. The third one is especially cute. (and how should I call this first one?) Something simple like: Forward reference error with struct opCall and const Let's see how much time it takes to reach 5000 bugs :-) Bye, bearophile

Re: Loop optimization

2010-05-15 Thread strtr
== Quote from Don (nos...@nospam.com)'s article strtr wrote: == Quote from bearophile (bearophileh...@lycos.com)'s article But the bigger problem in your code is that you are performing operations on NaNs (that's the default initalization of FP values in D), and operations on NaNs

Re: Three legitimate bugs? (D1.061)

2010-05-15 Thread strtr
== Quote from bearophile (bearophileh...@lycos.com)'s article strtr Wrote: Should I report these bugs? Yes, add them to bugzilla. The third one is especially cute. Was kind of expecting you to correct me or point me to the corresponding bugzillas ;D (and how should I call this first one?)

Re: Loop optimization

2010-05-15 Thread Ali Çehreli
Steven Schveighoffer wrote: double [] foo = new double [cast(int)1e6]; foo[] = 0; I've discovered that this is the equivalent of the last line above: foo = 0; I don't see it in the spec. Is that an old or an unintended feature? Ali

Re: Loop optimization

2010-05-15 Thread Simen kjaeraas
Ali Çehreli acehr...@yahoo.com wrote: Steven Schveighoffer wrote: double [] foo = new double [cast(int)1e6]; foo[] = 0; I've discovered that this is the equivalent of the last line above: foo = 0; I don't see it in the spec. Is that an old or an unintended feature? Looks

Re: Loop optimization

2010-05-15 Thread Ali Çehreli
Simen kjaeraas wrote: Ali Çehreli acehr...@yahoo.com wrote: Steven Schveighoffer wrote: double [] foo = new double [cast(int)1e6]; foo[] = 0; I've discovered that this is the equivalent of the last line above: foo = 0; I don't see it in the spec. Is that an old or an

Re: Loop optimization

2010-05-15 Thread bearophile
Ali Çehreli: I don't see it in the spec. Is that an old or an unintended feature? It's a compiler bug, don't use that bracket less syntax in your programs. Don is fighting to fix such problems (and I have written several posts and bug reports on that stuff). Bye, bearophile