summaryrefslogtreecommitdiff
path: root/md
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2022-08-09 11:03:33 +0100
committerFreeArtMan <dos21h@gmail.com>2022-08-09 11:03:33 +0100
commite3917966f16485f85b023f1ae36bc44b4a5f8171 (patch)
treebaae496a311f9b51f14076d7ea8f3ed7b0417f3f /md
parentf126fd27a3d895c02e72fbfaa4d0dae583f9636f (diff)
downloadmd-content-e3917966f16485f85b023f1ae36bc44b4a5f8171.tar.gz
md-content-e3917966f16485f85b023f1ae36bc44b4a5f8171.zip
Add stack
Diffstat (limited to 'md')
-rw-r--r--md/notes/undefined_c/titles.md43
1 files changed, 42 insertions, 1 deletions
diff --git a/md/notes/undefined_c/titles.md b/md/notes/undefined_c/titles.md
index 2c5bcd1..92b35ab 100644
--- a/md/notes/undefined_c/titles.md
+++ b/md/notes/undefined_c/titles.md
@@ -239,10 +239,51 @@ Now size of structure will be 32.
All results on amd64, other arch may differ.
+### How to shoot leg
+Forget that struct size is not consistent.
+### Recursion
+
+Recursion is technique that could be useful to write shorter code
+and deal with cycles. One thing that recursion suffer is that it consumes
+stack memory and its have default limit on platform.
+
+```c
+#include <stdio.h>
+#include <stdlib.h>
+
+int fun_r(int i) {
+ printf("val %d\n",i);
+ fun_r(i+1);
+ return 0;
+}
+
+int main()
+{
+ fun_r(0);
+}
+```
+
+Program will fail after its reach out of stack range.
+When increase the default stack limit it go more further.
+
+
+Check default stack size
+
+```
+ulimit -s
+```
+
+Set stack size
+
+```
+ulimit -s 16384
+```
-### Recursion
### Macro
+
+
+
### Signed/Unsigned
### Pointers
### Endianess