Mercurial > projects > ldc
annotate lphobos/std/outofmemory.d @ 885:8ad512fd8e8f
tag 0.9 revision
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 12 Jan 2009 07:55:17 +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 } |