Mercurial > projects > ldc
comparison lphobos/internal/objectimpl.d @ 35:3cfcb944304e trunk
[svn r39] * Updated to DMD 1.022 with the exception of:
Bugzilla 278: dmd.conf search path doesn't work
This fix was causing crashes for me :/ So for it's the old behaviour
author | lindquist |
---|---|
date | Tue, 09 Oct 2007 06:21:30 +0200 |
parents | c53b6e3fe49a |
children | 0b9b286b67b6 |
comparison
equal
deleted
inserted
replaced
34:4648206ca213 | 35:3cfcb944304e |
---|---|
107 * Convert Object to a human readable string. | 107 * Convert Object to a human readable string. |
108 */ | 108 */ |
109 char[] toString() | 109 char[] toString() |
110 { | 110 { |
111 //return this.classinfo.name; | 111 //return this.classinfo.name; |
112 return "classinfo.name not yet implemented"; | 112 return "Object.toString: classinfo not yet implemented"; |
113 } | 113 } |
114 | 114 |
115 /** | 115 /** |
116 * Compute hash function for Object. | 116 * Compute hash function for Object. |
117 */ | 117 */ |
133 int opCmp(Object o) | 133 int opCmp(Object o) |
134 { | 134 { |
135 // BUG: this prevents a compacting GC from working, needs to be fixed | 135 // BUG: this prevents a compacting GC from working, needs to be fixed |
136 //return cast(int)cast(void *)this - cast(int)cast(void *)o; | 136 //return cast(int)cast(void *)this - cast(int)cast(void *)o; |
137 | 137 |
138 assert(0, "need opCmp for class <no classinfo yet>"); | |
139 return 0; | |
138 //throw new Error("need opCmp for class " ~ this.classinfo.name); | 140 //throw new Error("need opCmp for class " ~ this.classinfo.name); |
139 assert(0); | |
140 return 0; | |
141 } | 141 } |
142 | 142 |
143 /** | 143 /** |
144 * Returns !=0 if this object does have the same contents as obj. | 144 * Returns !=0 if this object does have the same contents as obj. |
145 */ | 145 */ |
254 } | 254 } |
255 | 255 |
256 free(dgs.ptr); | 256 free(dgs.ptr); |
257 } | 257 } |
258 } | 258 } |
259 | |
260 | 259 |
261 /** | 260 /** |
262 * Information about an interface. | 261 * Information about an interface. |
263 * A pointer to this appears as the first entry in the interface's vtbl[]. | 262 * A pointer to this appears as the first entry in the interface's vtbl[]. |
264 */ | 263 */ |
340 { | 339 { |
341 size_t offset; /// Offset of member from start of object | 340 size_t offset; /// Offset of member from start of object |
342 TypeInfo ti; /// TypeInfo for this member | 341 TypeInfo ti; /// TypeInfo for this member |
343 } | 342 } |
344 | 343 |
345 | |
346 /** | 344 /** |
347 * Runtime type information about a type. | 345 * Runtime type information about a type. |
348 * Can be retrieved for any type using a | 346 * Can be retrieved for any type using a |
349 * <a href="../expression.html#typeidexpression">TypeidExpression</a>. | 347 * <a href="../expression.html#typeidexpression">TypeidExpression</a>. |
350 */ | 348 */ |
1022 void swap(void *p1, void *p2) | 1020 void swap(void *p1, void *p2) |
1023 { | 1021 { |
1024 assert(0); | 1022 assert(0); |
1025 } | 1023 } |
1026 } | 1024 } |
1025 +/ | |
1027 | 1026 |
1028 /** | 1027 /** |
1029 * All recoverable exceptions should be derived from class Exception. | 1028 * All recoverable exceptions should be derived from class Exception. |
1030 */ | 1029 */ |
1031 class Exception : Object | 1030 class Exception : Object |
1040 this.msg = msg; | 1039 this.msg = msg; |
1041 } | 1040 } |
1042 | 1041 |
1043 void print() | 1042 void print() |
1044 { | 1043 { |
1045 printf("%.*s\n", toString()); | 1044 auto str = toString(); |
1045 printf("%.*s\n", str.length, str.ptr); | |
1046 } | 1046 } |
1047 | 1047 |
1048 char[] toString() { return msg; } | 1048 char[] toString() { return msg; } |
1049 } | 1049 } |
1050 | 1050 |
1069 this.next = next; | 1069 this.next = next; |
1070 } | 1070 } |
1071 } | 1071 } |
1072 | 1072 |
1073 //extern (C) int nullext = 0; | 1073 //extern (C) int nullext = 0; |
1074 | |
1075 +/ |