author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Sun, 24 Oct 2010 20:58:01 +0200 | |
changeset 151 | a8c2649cf277 |
parent 77 | 49e0babccb23 |
permissions | -rw-r--r-- |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
1 |
/** |
77 | 2 |
* blackhole.c |
9
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
3 |
* Copyright (C) 2008 Markus Broeker |
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
4 |
* |
c3fecc82ade6
standard tags for git projects
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
5 |
* compile with -O0 or without optimizations or it won't crash |
0 | 6 |
*/ |
7 |
||
8 |
#include <stdio.h> |
|
9 |
#include <stdlib.h> |
|
10 |
||
11 |
unsigned long blackhole (unsigned long i) |
|
12 |
{ |
|
13 |
/* |
|
14 |
* blackhole stops after a datatype overrun |
|
15 |
*/ |
|
16 |
if ((i + 1) < i) |
|
17 |
return i; |
|
18 |
||
19 |
if (!(i % 10000)) |
|
20 |
printf ("Recursion %lu\n", i); |
|
21 |
||
22 |
return blackhole (i + 1); |
|
23 |
} |
|
24 |
||
25 |
int main (void) |
|
26 |
{ |
|
27 |
printf ("MAXIMUM RECURSION DEPTH ON YOUR MACHINE: %lu\n", blackhole (0)); |
|
28 |
||
29 |
return EXIT_SUCCESS; |
|
30 |
} |