author | Markus Bröker<broeker.markus@googlemail.com> |
Sun, 10 Feb 2019 13:17:01 +0100 | |
changeset 173 | 374a86886bc5 |
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 |
} |