Thread overview |
---|
October 10, 2005 Class comparison problems | ||||
---|---|---|---|---|
| ||||
First of all, I'm not an English speaker. So be tolerant of my poor English. I'm using Win32 compiler v0.135. I wrote the following code and had some problems: int main() { Object c = new Object; Object d = null; if (null == c) {} // Access Violation if (c == null) {} // Ok if (d == c) {} // Access Violation if (c == d) {} // Ok bit b; b = (1 == 2); // Ok b = (c == d); // Compile Error(cannot convert int to bit) return 0; } I'm sorry if these are known issues... |
October 11, 2005 Re: Class comparison problems | ||||
---|---|---|---|---|
| ||||
Posted in reply to Niboshi | In article <dieq96$187c$1@digitaldaemon.com>, Niboshi says... > >First of all, I'm not an English speaker. So be tolerant of my poor English. > >I'm using Win32 compiler v0.135. >I wrote the following code and had some problems: > >int main() >{ >Object c = new Object; >Object d = null; >if (null == c) {} // Access Violation >if (c == null) {} // Ok >if (d == c) {} // Access Violation >if (c == d) {} // Ok All of these should use the "is" operator. # if(null is c){} # if(c is null){} # ... > >bit b; >b = (1 == 2); // Ok >b = (c == d); // Compile Error(cannot convert int to bit) > >return 0; >} > >I'm sorry if these are known issues... > > Your English is better than some of the postings from English speakers (my self included). |
October 11, 2005 Re: Class comparison problems | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | In article <dif1c1$5cm$1@digitaldaemon.com>, BCS says... > >In article <dieq96$187c$1@digitaldaemon.com>, Niboshi says... >> >>First of all, I'm not an English speaker. So be tolerant of my poor English. >> >>I'm using Win32 compiler v0.135. >>I wrote the following code and had some problems: >> >>int main() >>{ >>Object c = new Object; >>Object d = null; >>if (null == c) {} // Access Violation >>if (c == null) {} // Ok >>if (d == c) {} // Access Violation >>if (c == d) {} // Ok > > >All of these should use the "is" operator. > ># if(null is c){} ># if(c is null){} ># ... > > > >> >>bit b; >>b = (1 == 2); // Ok >>b = (c == d); // Compile Error(cannot convert int to bit) >> >>return 0; >>} >> >>I'm sorry if these are known issues... >> >> > > >Your English is better than some of the postings from English speakers (my self >included). > > Thanks a lot! I should have read documentation more carefully before posting :) |
Copyright © 1999-2021 by the D Language Foundation