Thread overview
Class comparison problems
Oct 10, 2005
Niboshi
Oct 11, 2005
BCS
Oct 11, 2005
Niboshi
October 10, 2005
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
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
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 :)