Re: Yet more OPTLINK woes

2010-05-17 Thread Nick Sabalausky
"Daniel Keep" wrote in message news:hse30q$1tn...@digitalmars.com... > > That's right, it's time for everyone's favourite [1] game: guess why > OPTLINK's not working! [2] > > *sigh* I'm writing a math eval library. There are two test > applications. LexerTest only touches part of the code. As

Re: Yet more OPTLINK woes

2010-05-17 Thread Nick Sabalausky
"div0" wrote in message news:hshfe9$o0...@digitalmars.com... > > Strange what OPTLINK is doing; normally it crashes at the drop of a hat, > so it seems unreasonable that it processes the .obj a bit then > (un)successfully exits. Maybe the .obj is corrupt in some way that makes > it look empty, so

Re: Loop optimization

2010-05-17 Thread bearophile
Walter Bright: >In my view, such switches are bad news, because:< The Intel compiler, Microsoft compiler, GCC and LLVM have a similar switch (fp:fast in the Microsoft compiler, -ffast-math on GCC, etc). So you might send your list of comments to the devs of each of those four compilers. I have

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread bearophile
Steven Schveighoffer: > No, I was simply wrong :) I think it's by design. Which means the > original bug report is valid. The original bug report is valid, but I don't understand that code still. Is the const implying a static only in some situations? Why is this OK for the compiler: struct

Re: Operators overloading in D2

2010-05-17 Thread Steven Schveighoffer
On Mon, 17 May 2010 16:38:49 -0400, Larry Luther wrote: Hi, Dan used the following method for his vector class: void opOpAssign (string op:"+=")(ref Vector3 other) {...} Why the "ref"? As I understand it, objects of class vector would already be passed as references. Larry Yes, ref

Re: Operators overloading in D2

2010-05-17 Thread Larry Luther
Hi, Dan used the following method for his vector class: void opOpAssign (string op:"+=")(ref Vector3 other) {...} Why the "ref"? As I understand it, objects of class vector would already be passed as references. Larry

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread Steven Schveighoffer
On Mon, 17 May 2010 15:31:23 -0400, bearophile wrote: Steven Schveighoffer: Unlike some languages, D1 const does not imply static. Which means you are trying to define an S as containing an S, which would then contain another S and so on. It seems the const implies static, in structs...

Re: Different typeof syntax

2010-05-17 Thread bearophile
Robert Clipsham: > The closest I've managed with my quick attempt is: > > mixin template typeOf() > { > alias typeof(this) typeOf; > } > struct Foo > { > int x; > mixin typeOf; > } Thank you for your code :-) Your example shows this feature can become a built-in. > I cha

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread bearophile
Steven Schveighoffer: > Unlike some languages, D1 const does not imply static. Which means you > are trying to define an S as containing an S, which would then contain > another S and so on. It seems the const implies static, in structs... I don't know if this is by design, or it's a compiler b

Re: Loop optimization

2010-05-17 Thread Walter Bright
bearophile wrote: So I have added an extra "unsafe floating point" optimization: ldc -O3 -release -inline -enable-unsafe-fp-math -output-s test In my view, such switches are bad news, because: 1. very few people understand the issues regarding wrong floating point optimizations 2. even tho

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread Steven Schveighoffer
On Mon, 17 May 2010 10:28:47 -0400, strtr wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Sat, 15 May 2010 16:15:23 -0400, strtr wrote: > Should I report these bugs? > (and how should I call this first one?) > > module main; > //const S S1 = S(); // uncomment

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread strtr
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > On Sat, 15 May 2010 16:15:23 -0400, strtr wrote: > > 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 > > { > >

Re: Loop optimization

2010-05-17 Thread BCS
Hello Don, The most glaring limitation of the FP optimiser is that it seems to never keep values in the FP stack. So that it will often do: FSTP x FLD x instead of FST x Fixing this would probably give a speedup of ~20% on almost all FP code, and would unlock the path to further optimisation.

Re: Three legitimate bugs? (D1.061)

2010-05-17 Thread Steven Schveighoffer
On Sat, 15 May 2010 16:15:23 -0400, strtr wrote: 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(){

Re: Loop optimization

2010-05-17 Thread Steven Schveighoffer
On Fri, 14 May 2010 12:40:52 -0400, bearophile wrote: Steven Schveighoffer: In C/C++, the default value for doubles is 0. I think in C and C++ the default value for doubles is "uninitialized" (that is anything). You are probably right. All I did to figure this out is print out the f

Re: Loop optimization

2010-05-17 Thread Don
Walter Bright wrote: Don wrote: 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 behi

Re: Loop optimization

2010-05-17 Thread bearophile
Walter Bright: > is not done because of roundoff error. Also, > 0 * x => 0 > is also not done because it is not a correct replacement if x is a NaN. I have done a little experiment, compiling this D1 code with LDC: import tango.stdc.stdio: printf; void main(char[][] args) { double x = c