Re: Compare two objects

2009-02-10 Thread Qian Xu
grauzone wrote:
 
 Conclusion: == is absolutely useless in your case. Use something else.

But you have to write much more, just like my test(..) function does

--Qian Xu


Re: Compare two objects

2009-02-10 Thread Frits van Bommel

Qian Xu wrote:

Hi All,

I want to test, if two objects are equal. 
The rules are as follows: 
1. When both are null, it should return true. 
2. When one of them is null, it should return false.

3. When both not null, then compare their values (as two strings)


((a is b) || (a  a == b))

Note that if a and b are both the same non-null object, opEquals will 
not be called; it'll just evaluate to true.



It's not very nice-looking, but it's the best you can do.
Of course, you could put it into a function:
-
bool equals(T)(T a, T b) {
return ((a is b) || (a  a == b));
}
-

Note that this may behave strangely for empty arrays:
-
char[] str;
equals(str, ); // returns false
-
But of course, that's what you asked for. 'str' is null and  isn't...


Re: Compare two objects

2009-02-10 Thread Frank Benoit
(a  a == b)
is sufficient for his use case. Because he wants the way with the least
amount of typing.


Re: Compare two objects

2009-02-10 Thread Frank Benoit
Frank Benoit schrieb:
 (a  a == b)
 is sufficient for his use case. Because he wants the way with the least
 amount of typing.

hm, no :(


Example Attached

2009-02-10 Thread Heinz
Heinz Wrote:

 Hello everyone.
 I've been using DLL's in D for a long time but just recently i'm having a 
 problem. Lets see if someone can help me a bit.
 
 I have several lines of code but i'll use an example from the DMD site wich 
 is almost the same come.
 
 Read the DMD site about DLL's here: http://www.digitalmars.com/d/1.0/dll.html
 
 Check for the section D code calling D code in DLLs.
 
 If you extern(C) all exports in mydll.d and change all symbols in test.d to 
 their C respectives, when running you'll get access violation.
 
 Any ideas?

I attached a rar file with the sources just to see what i'm talking about. The 
example is from the DMD site. Included is the extern D (ok) and the extern C 
(fails). To compile open compile.bat and to run the programs use run.bat.


mydll.rar
Description: application/rar


Internal error: ..\ztc\evalu8.c 2093

2009-02-10 Thread Zarathustra
When I trying build dwt-win 3.4.1 I get the following error:
  Internal error: ..\ztc\evalu8.c 2093

command line:
  dsss build

I using DSSS 0.78, Tango 0.99.7 with DMD 1.033.
OS: Windows XP

Any ideas?


Re: Internal error: ..\ztc\evalu8.c 2093

2009-02-10 Thread Jarrett Billingsley
On Tue, Feb 10, 2009 at 3:50 PM, Zarathustra adam.chrapkow...@gmail.com wrote:
 When I trying build dwt-win 3.4.1 I get the following error:
  Internal error: ..\ztc\evalu8.c 2093

 command line:
  dsss build

 I using DSSS 0.78, Tango 0.99.7 with DMD 1.033.
 OS: Windows XP

 Any ideas?


http://d.puremagic.com/issues/show_bug.cgi?id=2430


Re: Internal error: ..\ztc\evalu8.c 2093

2009-02-10 Thread Zarathustra
Of course, but bug is still not resolved.
Any ideas, what can I do to bypass a problem?

Jarrett Billingsley Wrote:

 On Tue, Feb 10, 2009 at 3:50 PM, Zarathustra adam.chrapkow...@gmail.com 
 wrote:
  When I trying build dwt-win 3.4.1 I get the following error:
   Internal error: ..\ztc\evalu8.c 2093
 
  command line:
   dsss build
 
  I using DSSS 0.78, Tango 0.99.7 with DMD 1.033.
  OS: Windows XP
 
  Any ideas?
 
 
 http://d.puremagic.com/issues/show_bug.cgi?id=2430



Re: Internal error: ..\ztc\evalu8.c 2093

2009-02-10 Thread John Reimer

Hello Zarathustra,


When I trying build dwt-win 3.4.1 I get the following error:
Internal error: ..\ztc\evalu8.c 2093
command line:
dsss build
I using DSSS 0.78, Tango 0.99.7 with DMD 1.033.
OS: Windows XP
Any ideas?




Can you try a more recent compiler... like dmd 1.037?


Also, I would highly recommend /not/ using DSSS version 0.78.  I suggest 
you use 0.75.  You can use 0.78 if you enjoy looong build times. :)



-JJR