Skip to content

Instantly share code, notes, and snippets.

View pkutaj's full-sized avatar

pavol kutaj pkutaj

View GitHub Profile
@pkutaj
pkutaj / tmpzmefups9.md
Created May 1, 2026 23:18
CTJ47_Why_a_Stack snippet
Year Milestone
1957 FORTRAN — static allocation only, no heap
1960 LISP — first language with dynamic allocation + GC
1960 ALGOL 60 — introduced stack frames as a formal concept
1966 DRAM invented by Robert Dennard at IBM
1972 C — direct control via malloc()/free()
@pkutaj
pkutaj / tmpenkv6pc_.c
Created May 1, 2026 23:18
CTJ47_Why_a_Stack snippet
# include <stdio.h>
int* dangerous() {
int x = 42;
return &x;
}
int main() {
int* p = dangerous();
printf("print pointer of dangerious: %d\n", *p);
@pkutaj
pkutaj / tmp9m3i53k8.txt
Created May 1, 2026 23:18
CTJ47_Why_a_Stack snippet
[cling]$ main()
print pointer of dangerious: 42
(int) 0
@pkutaj
pkutaj / tmpihugjnf4.c
Created May 1, 2026 23:18
CTJ47_Why_a_Stack snippet
# include <stdio.h>
int* dangerous() {
int x = 42;
return &x;
}
void overwriter() {
int y = 999;
}
@pkutaj
pkutaj / tmp3a9y93nw.txt
Created May 1, 2026 23:18
CTJ47_Why_a_Stack snippet
[cling]$ main()
print the value of dangerous: 999
(int) 0
@pkutaj
pkutaj / tmps1d5cqbi.c
Created April 20, 2026 07:21
CTJ-46: The Stack snippet
#include <stdio.h>
void z_func() {
int x = 10;
printf("&x = %p\n", (void*)&x);
}
void y_func() {
int x = 10;
printf("&x = %p\n", (void*)&x);
@pkutaj
pkutaj / tmpd_2tj4w3.c
Created April 20, 2026 07:21
CTJ-46: The Stack snippet
[cling]$ main()
&hx = 0x16d981f78 // main(); 6133653368
&x = 0x16d981f5c // x_func; 6133653340
&x = 0x16d981f3c // y_func; 6133653308
&x = 0x16d981f1c // z_func; 6133653276
(int) 0
@pkutaj
pkutaj / tmpyepurgrn.txt
Created April 20, 2026 07:21
CTJ-46: The Stack snippet
[ins] In [7]: 0x16d981f78 - 0x16d981f5c
Out[7]: 28
@pkutaj
pkutaj / tmpoa70dnmx.txt
Created April 20, 2026 07:20
CTJ-46: The Stack snippet
[13714] 4211ab88-ad0a-497b-9281-de9db24959c8 <Error>: DynamicQueryHandler Code: 62. DB::Exception: Empty query. (SYNTAX_ERROR), Stack trace (when copying this message, always include the lines below):
@pkutaj
pkutaj / tmp6s4xtcgs.md
Created April 20, 2026 07:20
CTJ-46: The Stack snippet
Frame Source file:line Function signature Address
0 ./src/Common/Exception.cpp:133 DB::Exception::Exception(MessageMasked&&, int, bool) 0x165d072a
1 (not shown) DB::Exception::Exception(String const&, int, String, bool) 0x15158c4e
2 ./src/Common/Exception.h:130 DB::Exception::createDeprecated(String const&, int, bool) 0x169326df
3 ./src/Parsers/parseQuery.cpp:411 DB::parseQueryAndMovePosition(IParser&, char const*&, ...) 0x1e76cbb2
4 ./src/Parsers/parseQuery.cpp:424 DB::executeQueryImpl(char const*, char const*, ...) 0x1bce0e32
5 `./src/Interpreters/executeQuery.c