www.digitalmars.com         C & C++   DMDScript  

D - From comp.lang.c++.moderated - a (very long!) discussion about D

David Abrahams <dave boost-consulting.com> wrote in message
news:<uvfskfk54.fsf boost-consulting.com>...
 stlsoft hotmail.com (Matthew Wilson) writes:

 I've argued in the past to Walter that the expression x == y should be
 rewritten by the compiler as

   (x !== null && y !== null)
     ? x.eq(y)
     : false

So null != null?

He, he. I've never tried it. Trying now ... ... Bizarre. The following code class X {}; int main(char[][] args) { if(null != null) { printf("null Different\n"); } else { printf("null Same\n"); } X x1; X x2; if(x1 != x1) { printf("X Different\n"); } else { printf("X Same\n"); } return 0; } prints "null Same" "Error: Access Violation" which is a surprise to me, as I'd expected an access violation for both. This is inconsistent, to say the least. (I shall post this on D ng now, methinks). This is a constant beef between me Walter. It's a curious battle, since I have right on my side, and he has absolute authority on his. (Kind of like being married <g>) Matthew Wilson STLSoft moderator and C++ monomaniac mailto:matthew stlsoft.org http://www.stlsoft.org news://news.digitalmars.com/c++.stlsoft "You can tell a Yorkshireman, but you can't tell him much!" -- Uncle Michael ---------------------------------------------------------------------------- ---
Aug 26 2003