Mercurial > projects > ldc
annotate lphobos/std/outofmemory.d @ 1351:8d501abecd24
Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Thu, 14 May 2009 17:20:17 +0200 |
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 } |