Mercurial > projects > ldc
annotate lphobos/std/outofmemory.d @ 837:331a176c1f4f
Removed error on naked, not fully complete, but I'll be doing more work on it during this Christmas, and some things do work.
Fixed taking delegate of final class method. see mini/delegate3.d.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 09 Dec 2008 14:07:30 +0100 |
parents | 88e23f8c2354 |
children |
rev | line source |
---|---|
89 | 1 /** |
2 * Macros: | |
3 * WIKI=Phobos/StdOutOfMemory | |
4 * Copyright: | |
5 * Placed into public domain. | |
6 * www.digitalmars.com | |
7 */ | |
8 | |
9 | |
10 module std.outofmemory; | |
11 | |
12 /****** | |
13 * This exception is thrown when out of memory errors happen. | |
14 */ | |
15 | |
16 class OutOfMemoryException : Exception | |
17 { | |
18 static char[] s = "Out of memory"; | |
19 | |
20 /** | |
21 * Default constructor | |
22 */ | |
23 this() | |
24 { | |
25 super(s); | |
26 } | |
27 | |
28 char[] toString() | |
29 { | |
30 return s; | |
31 } | |
32 } | |
33 | |
34 extern (C) void _d_OutOfMemory() | |
35 { | |
662
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
36 printf("Out of memory!\n"); |
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
37 *(cast(int*) 0) = 0; |
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
38 throw cast(OutOfMemoryException) |
89 | 39 cast(void *) |
662
88e23f8c2354
Applied downs' latest Phobos patch
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
89
diff
changeset
|
40 OutOfMemoryException.classinfo.init; |
89 | 41 } |
42 | |
43 static this() | |
44 { | |
45 } |