Re: 'Undefined reference' linking errors

2010-04-07 Thread Robert Clipsham
On 07/04/10 22:19, bearophile wrote: Those mangled ids are ugly. It's much better to show programmers more readable names in error messages. This can even become a bug report. These errors are being given by the linker, and the linker doesn't know how to demangle D symbols, so it doesn't. If

Re: writefln on interface array

2010-04-07 Thread strtr
Ellery Newcomer Wrote: > > s/interface I{}/interface I{ char[] toString(); }/ > s/writefln(two_i)/writefln("%s",two_i)/ > > ? no :( > > or see bug 535 voted ++

Re: 'Undefined reference' linking errors

2010-04-07 Thread bearophile
Ali Çehreli: > > test.o:(.rodata+0x98): undefined reference to > > `_D5dregs3avg12avg_weighted6opCallMFKAS5dregs10reputation6ratingKAdKAdZv' > > test.o:(.rodata+0xf8): undefined reference to > > I wonder how you missed the "opCall" in there! :p Those mangled ids are ugly. It's much better to

Re: 'Undefined reference' linking errors

2010-04-07 Thread bearophile
Ali Çehreli: > > avg_weighted(ratings,reputation_user,reputation_object); And I have missed this is my cleaning of the code :-) Bye, bearophile

Re: 'Undefined reference' linking errors

2010-04-07 Thread bearophile
Few notes: - opCall() of AvgWeighted was abstract. - keep in mind that in D classes are CamelCase; - variable names are written like weightSum (but once in a while a underscore doesn't kill). - Be careful because ref arguments are tricky. - There is a line like foreach (r; reputationUser) r = 1; t

Re: 'Undefined reference' linking errors

2010-04-07 Thread Ali Çehreli
Joseph Wakeling wrote: > void opCall(ref rating[] ratings, > ref double[] reputation_user, > ref double[] reputation_object); The errors are for the missing definitions of that function. Either provide a definition, or just remove that declaration

'Undefined reference' linking errors

2010-04-07 Thread Joseph Wakeling
Hello everyone, A probably stupid but I-can't-find-the-solution-with-Google problem. I'm trying to compile a small project I'm working on to learn D, called 'dregs'. It's just 3 files for now (2 modules plus a little test program). Unfortunately every time I try and compile, I get 'undefined ref

Re: writefln on interface array

2010-04-07 Thread Ellery Newcomer
On 04/07/2010 06:13 AM, strtr wrote: Is it possible to have this output [null,"1"] in stead of Error: std.format formatArg? interface I{} class C:I{ int index; char[] toString(){ return toString(index) } } I[2] two_i; I[1] = new C(); writefln(two_i); Would be handy for debugging ;) s/int

writefln on interface array

2010-04-07 Thread strtr
Is it possible to have this output [null,"1"] in stead of Error: std.format formatArg? interface I{} class C:I{ int index; char[] toString(){ return toString(index) } } I[2] two_i; I[1] = new C(); writefln(two_i); Would be handy for debugging ;)

Re: String literal arguments

2010-04-07 Thread Yao G.
On Wed, 07 Apr 2010 03:05:34 -0400, Simen kjaeraas wrote: Yao G. wrote: Hello. Greetings. foo( "Hello World", first, second ); --- You can notice that the first argument is a string literal. What I want to know is: If a function argument is declared as a string literal, it can be

Re: String literal arguments

2010-04-07 Thread bearophile
You have to take a look at what the compiler does normally. It doesn't do magic. Generally a function is something that takes a run-time value with a simple protocol. So when an argument is inside a function, it's a variable, even if the function was called with a constant. Walter actually trie

Re: String literal arguments

2010-04-07 Thread Simen kjaeraas
Yao G. wrote: Hello. Greetings. foo( "Hello World", first, second ); --- You can notice that the first argument is a string literal. What I want to know is: If a function argument is declared as a string literal, it can be accessed at compile time? And if the answer is yes, how can I d

Re: Confused about class equality

2010-04-07 Thread Justin Spahr-Summers
On Tue, 06 Apr 2010 23:35:01 -0400, strtr wrote: > > Justin Spahr-Summers Wrote: > > > > Hmm, that is pretty weird. Are you doing any casts anywhere, or any > > pointer arithmetic/tricks? > A search for cast didn't show any related casts. > Do you maybe know another thing to check? > I do thro