Beyond Indexes: How Open Table Formats Optimize Query Performance
https://www.reddit.com/r/programming/comments/1sdv3kd/beyond_indexes_how_open_table_formats_optimize/
submitted by /u/fagnerbrack (https://www.reddit.com/user/fagnerbrack)
[link] (https://jack-vanlightly.com/blog/2025/10/8/beyond-indexes-how-open-table-formats-optimize-query-performance) [comments] (https://www.reddit.com/r/programming/comments/1sdv3kd/beyond_indexes_how_open_table_formats_optimize/)
https://www.reddit.com/r/programming/comments/1sdv3kd/beyond_indexes_how_open_table_formats_optimize/
submitted by /u/fagnerbrack (https://www.reddit.com/user/fagnerbrack)
[link] (https://jack-vanlightly.com/blog/2025/10/8/beyond-indexes-how-open-table-formats-optimize-query-performance) [comments] (https://www.reddit.com/r/programming/comments/1sdv3kd/beyond_indexes_how_open_table_formats_optimize/)
Stamp It! All Programs Must Report Their Version
https://www.reddit.com/r/programming/comments/1sdy11q/stamp_it_all_programs_must_report_their_version/
submitted by /u/SpecialistLady (https://www.reddit.com/user/SpecialistLady)
[link] (https://michael.stapelberg.ch/posts/2026-04-05-stamp-it-all-programs-must-report-their-version/) [comments] (https://www.reddit.com/r/programming/comments/1sdy11q/stamp_it_all_programs_must_report_their_version/)
https://www.reddit.com/r/programming/comments/1sdy11q/stamp_it_all_programs_must_report_their_version/
submitted by /u/SpecialistLady (https://www.reddit.com/user/SpecialistLady)
[link] (https://michael.stapelberg.ch/posts/2026-04-05-stamp-it-all-programs-must-report-their-version/) [comments] (https://www.reddit.com/r/programming/comments/1sdy11q/stamp_it_all_programs_must_report_their_version/)
How the Sharks Do Observability
https://www.reddit.com/r/programming/comments/1se0at6/how_the_sharks_do_observability/
submitted by /u/elizObserves (https://www.reddit.com/user/elizObserves)
[link] (https://newsletter.signoz.io/p/how-the-sharks-do-observability) [comments] (https://www.reddit.com/r/programming/comments/1se0at6/how_the_sharks_do_observability/)
https://www.reddit.com/r/programming/comments/1se0at6/how_the_sharks_do_observability/
submitted by /u/elizObserves (https://www.reddit.com/user/elizObserves)
[link] (https://newsletter.signoz.io/p/how-the-sharks-do-observability) [comments] (https://www.reddit.com/r/programming/comments/1se0at6/how_the_sharks_do_observability/)
The Data Race Hiding Behind "Correct" Atomics
https://www.reddit.com/r/programming/comments/1se1ypz/the_data_race_hiding_behind_correct_atomics/
submitted by /u/devTripp (https://www.reddit.com/user/devTripp)
[link] (https://trippw.com/blog/lock-free-metrics-atomic-pointer) [comments] (https://www.reddit.com/r/programming/comments/1se1ypz/the_data_race_hiding_behind_correct_atomics/)
https://www.reddit.com/r/programming/comments/1se1ypz/the_data_race_hiding_behind_correct_atomics/
submitted by /u/devTripp (https://www.reddit.com/user/devTripp)
[link] (https://trippw.com/blog/lock-free-metrics-atomic-pointer) [comments] (https://www.reddit.com/r/programming/comments/1se1ypz/the_data_race_hiding_behind_correct_atomics/)
I poorly estimated a year long rewrite
https://www.reddit.com/r/programming/comments/1se324q/i_poorly_estimated_a_year_long_rewrite/
submitted by /u/levodelellis (https://www.reddit.com/user/levodelellis)
[link] (https://bold-edit.com/devlog/one-year-rewrite.html) [comments] (https://www.reddit.com/r/programming/comments/1se324q/i_poorly_estimated_a_year_long_rewrite/)
https://www.reddit.com/r/programming/comments/1se324q/i_poorly_estimated_a_year_long_rewrite/
submitted by /u/levodelellis (https://www.reddit.com/user/levodelellis)
[link] (https://bold-edit.com/devlog/one-year-rewrite.html) [comments] (https://www.reddit.com/r/programming/comments/1se324q/i_poorly_estimated_a_year_long_rewrite/)
Measuring Jitter: Standard Linux vs PREEMPT_RT under heavy load
https://www.reddit.com/r/programming/comments/1se3lsn/measuring_jitter_standard_linux_vs_preempt_rt/
<!-- SC_OFF --> I've been working on a Software PLC where microsecond-level execution timing is critical. To guarantee real-time performance, I tested and compared the scheduling jitter between a standard Linux kernel and a PREEMPT_RT patched kernel (Ubuntu 24.04). The Setup: A C++ task waking up every 10ms using clock_nanosleep, running for 10,000 iterations. Applied heavy system load using stress-ng (CPU 100%, Disk I/O, Context switches, Page faults). CPU governor set to 'performance'. The Results (Worst-case Jitter): Standard Linux Kernel: Extremely unpredictable. Jitter spiked up to ~650 Β΅s when the system was under stress. PREEMPT_RT Kernel: Very stable. The worst-case jitter was strictly bounded under 70 Β΅s. It's impressive how much stability the PREEMPT_RT patch brings to a general-purpose OS without needing a dedicated RTOS. I also learned a hard lesson about not doing File I/O inside an RT loop the hard way! π Any feedback or tips on further tuning (like IRQ Affinity) would be greatly appreciated! <!-- SC_ON --> submitted by /u/Special_Ad5912 (https://www.reddit.com/user/Special_Ad5912)
[link] (https://prejudice.tistory.com/42) [comments] (https://www.reddit.com/r/programming/comments/1se3lsn/measuring_jitter_standard_linux_vs_preempt_rt/)
https://www.reddit.com/r/programming/comments/1se3lsn/measuring_jitter_standard_linux_vs_preempt_rt/
<!-- SC_OFF --> I've been working on a Software PLC where microsecond-level execution timing is critical. To guarantee real-time performance, I tested and compared the scheduling jitter between a standard Linux kernel and a PREEMPT_RT patched kernel (Ubuntu 24.04). The Setup: A C++ task waking up every 10ms using clock_nanosleep, running for 10,000 iterations. Applied heavy system load using stress-ng (CPU 100%, Disk I/O, Context switches, Page faults). CPU governor set to 'performance'. The Results (Worst-case Jitter): Standard Linux Kernel: Extremely unpredictable. Jitter spiked up to ~650 Β΅s when the system was under stress. PREEMPT_RT Kernel: Very stable. The worst-case jitter was strictly bounded under 70 Β΅s. It's impressive how much stability the PREEMPT_RT patch brings to a general-purpose OS without needing a dedicated RTOS. I also learned a hard lesson about not doing File I/O inside an RT loop the hard way! π Any feedback or tips on further tuning (like IRQ Affinity) would be greatly appreciated! <!-- SC_ON --> submitted by /u/Special_Ad5912 (https://www.reddit.com/user/Special_Ad5912)
[link] (https://prejudice.tistory.com/42) [comments] (https://www.reddit.com/r/programming/comments/1se3lsn/measuring_jitter_standard_linux_vs_preempt_rt/)
Parse, Don't Validate β In a Language That Doesn't Want You To Β· cekrem.github.io
https://www.reddit.com/r/programming/comments/1sesbjq/parse_dont_validate_in_a_language_that_doesnt/
submitted by /u/cekrem (https://www.reddit.com/user/cekrem)
[link] (https://cekrem.github.io/posts/parse-dont-validate-typescript/) [comments] (https://www.reddit.com/r/programming/comments/1sesbjq/parse_dont_validate_in_a_language_that_doesnt/)
https://www.reddit.com/r/programming/comments/1sesbjq/parse_dont_validate_in_a_language_that_doesnt/
submitted by /u/cekrem (https://www.reddit.com/user/cekrem)
[link] (https://cekrem.github.io/posts/parse-dont-validate-typescript/) [comments] (https://www.reddit.com/r/programming/comments/1sesbjq/parse_dont_validate_in_a_language_that_doesnt/)
C3 closes out its 0.7 era β focusing on simplicity and control before 0.8
https://www.reddit.com/r/programming/comments/1set2gu/c3_closes_out_its_07_era_focusing_on_simplicity/
<!-- SC_OFF -->C3 is trying to stay close to C in terms of control and predictability,
without piling on too much complexity This release is mostly about tightening semantics, improving inference,
and removing edge cases before moving into the 0.8 cycle. Itβs less about adding features and more about making the language and standard library consistent. <!-- SC_ON --> submitted by /u/Nuoji (https://www.reddit.com/user/Nuoji)
[link] (https://c3-lang.org/blog/c3-0-7-11-the-last-v0-7/) [comments] (https://www.reddit.com/r/programming/comments/1set2gu/c3_closes_out_its_07_era_focusing_on_simplicity/)
https://www.reddit.com/r/programming/comments/1set2gu/c3_closes_out_its_07_era_focusing_on_simplicity/
<!-- SC_OFF -->C3 is trying to stay close to C in terms of control and predictability,
without piling on too much complexity This release is mostly about tightening semantics, improving inference,
and removing edge cases before moving into the 0.8 cycle. Itβs less about adding features and more about making the language and standard library consistent. <!-- SC_ON --> submitted by /u/Nuoji (https://www.reddit.com/user/Nuoji)
[link] (https://c3-lang.org/blog/c3-0-7-11-the-last-v0-7/) [comments] (https://www.reddit.com/r/programming/comments/1set2gu/c3_closes_out_its_07_era_focusing_on_simplicity/)
Jim Webber Explains Fault-tolerance, Scalability & Why Computers Are Just Confident Drunks. #DistributedSystems
https://www.reddit.com/r/programming/comments/1seuifi/jim_webber_explains_faulttolerance_scalability/
submitted by /u/goto-con (https://www.reddit.com/user/goto-con)
[link] (https://youtu.be/Pb8brtgQYP8?list=PLEx5khR4g7PLjpaSO0XI-6euF483ORLyJ) [comments] (https://www.reddit.com/r/programming/comments/1seuifi/jim_webber_explains_faulttolerance_scalability/)
https://www.reddit.com/r/programming/comments/1seuifi/jim_webber_explains_faulttolerance_scalability/
submitted by /u/goto-con (https://www.reddit.com/user/goto-con)
[link] (https://youtu.be/Pb8brtgQYP8?list=PLEx5khR4g7PLjpaSO0XI-6euF483ORLyJ) [comments] (https://www.reddit.com/r/programming/comments/1seuifi/jim_webber_explains_faulttolerance_scalability/)
Live Life on the Edge: A Layered Strategy for Testing Data Models
https://www.reddit.com/r/programming/comments/1sevdsl/live_life_on_the_edge_a_layered_strategy_for/
submitted by /u/misterchiply (https://www.reddit.com/user/misterchiply)
[link] (https://www.chiply.dev/post-data-model-testing) [comments] (https://www.reddit.com/r/programming/comments/1sevdsl/live_life_on_the_edge_a_layered_strategy_for/)
https://www.reddit.com/r/programming/comments/1sevdsl/live_life_on_the_edge_a_layered_strategy_for/
submitted by /u/misterchiply (https://www.reddit.com/user/misterchiply)
[link] (https://www.chiply.dev/post-data-model-testing) [comments] (https://www.reddit.com/r/programming/comments/1sevdsl/live_life_on_the_edge_a_layered_strategy_for/)
You can't cancel a JavaScript promise (except sometimes you can)
https://www.reddit.com/r/programming/comments/1sew9fx/you_cant_cancel_a_javascript_promise_except/
submitted by /u/aardvark_lizard (https://www.reddit.com/user/aardvark_lizard)
[link] (https://www.inngest.com/blog/hanging-promises-for-control-flow) [comments] (https://www.reddit.com/r/programming/comments/1sew9fx/you_cant_cancel_a_javascript_promise_except/)
https://www.reddit.com/r/programming/comments/1sew9fx/you_cant_cancel_a_javascript_promise_except/
submitted by /u/aardvark_lizard (https://www.reddit.com/user/aardvark_lizard)
[link] (https://www.inngest.com/blog/hanging-promises-for-control-flow) [comments] (https://www.reddit.com/r/programming/comments/1sew9fx/you_cant_cancel_a_javascript_promise_except/)
Compare programming language and see them ranked with learnings!
https://www.reddit.com/r/programming/comments/1sflofe/compare_programming_language_and_see_them_ranked/
<!-- SC_OFF -->So I always wanted to rank programming languages and compare them on diff programming metrics. I have been learning Rust and got to compare it with various other languages just to see the differences. Also learning about complex programming concepts, such as memory efficiency and more. Love this tool to do it. I bet you will learn something new!!! <!-- SC_ON --> submitted by /u/No-Childhood-2502 (https://www.reddit.com/user/No-Childhood-2502)
[link] (https://langscompare.site/) [comments] (https://www.reddit.com/r/programming/comments/1sflofe/compare_programming_language_and_see_them_ranked/)
https://www.reddit.com/r/programming/comments/1sflofe/compare_programming_language_and_see_them_ranked/
<!-- SC_OFF -->So I always wanted to rank programming languages and compare them on diff programming metrics. I have been learning Rust and got to compare it with various other languages just to see the differences. Also learning about complex programming concepts, such as memory efficiency and more. Love this tool to do it. I bet you will learn something new!!! <!-- SC_ON --> submitted by /u/No-Childhood-2502 (https://www.reddit.com/user/No-Childhood-2502)
[link] (https://langscompare.site/) [comments] (https://www.reddit.com/r/programming/comments/1sflofe/compare_programming_language_and_see_them_ranked/)
Beyond Indexes: How Open Table Formats Optimize Query Performance β Jack Vanlightly
https://www.reddit.com/r/programming/comments/1sfm3hs/beyond_indexes_how_open_table_formats_optimize/
submitted by /u/fagnerbrack (https://www.reddit.com/user/fagnerbrack)
[link] (https://jack-vanlightly.com/blog/2025/10/8/beyond-indexes-how-open-table-formats-optimize-query-performance) [comments] (https://www.reddit.com/r/programming/comments/1sfm3hs/beyond_indexes_how_open_table_formats_optimize/)
https://www.reddit.com/r/programming/comments/1sfm3hs/beyond_indexes_how_open_table_formats_optimize/
submitted by /u/fagnerbrack (https://www.reddit.com/user/fagnerbrack)
[link] (https://jack-vanlightly.com/blog/2025/10/8/beyond-indexes-how-open-table-formats-optimize-query-performance) [comments] (https://www.reddit.com/r/programming/comments/1sfm3hs/beyond_indexes_how_open_table_formats_optimize/)
[arXiv] Fuzzing REST APIs in Industry: Necessary Features and Open Problems
https://www.reddit.com/r/programming/comments/1sfm5e0/arxiv_fuzzing_rest_apis_in_industry_necessary/
<!-- SC_OFF -->This is a technical, academic write-up of how an open-source fuzzer for REST APIs has been introduced and started to be used at Volkswagen <!-- SC_ON --> submitted by /u/arcuri82 (https://www.reddit.com/user/arcuri82)
[link] (https://arxiv.org/abs/2604.01759) [comments] (https://www.reddit.com/r/programming/comments/1sfm5e0/arxiv_fuzzing_rest_apis_in_industry_necessary/)
https://www.reddit.com/r/programming/comments/1sfm5e0/arxiv_fuzzing_rest_apis_in_industry_necessary/
<!-- SC_OFF -->This is a technical, academic write-up of how an open-source fuzzer for REST APIs has been introduced and started to be used at Volkswagen <!-- SC_ON --> submitted by /u/arcuri82 (https://www.reddit.com/user/arcuri82)
[link] (https://arxiv.org/abs/2604.01759) [comments] (https://www.reddit.com/r/programming/comments/1sfm5e0/arxiv_fuzzing_rest_apis_in_industry_necessary/)
Hashing in C++26
https://www.reddit.com/r/programming/comments/1sfmt0l/hashing_in_c26/
submitted by /u/Krystian-Piekos (https://www.reddit.com/user/Krystian-Piekos)
[link] (https://blog.infotraining.pl/hashing-in-cpp-26) [comments] (https://www.reddit.com/r/programming/comments/1sfmt0l/hashing_in_c26/)
https://www.reddit.com/r/programming/comments/1sfmt0l/hashing_in_c26/
submitted by /u/Krystian-Piekos (https://www.reddit.com/user/Krystian-Piekos)
[link] (https://blog.infotraining.pl/hashing-in-cpp-26) [comments] (https://www.reddit.com/r/programming/comments/1sfmt0l/hashing_in_c26/)
Regex Are Not the Problem. Strings Are.
https://www.reddit.com/r/programming/comments/1sfnk1y/regex_are_not_the_problem_strings_are/
<!-- SC_OFF -->I think it is a point of view that may seem controversial but it traces a historical precedent that is quite shareable (the Joda-Time case) and how it could be applied to the world of regular expressions, a bit like the transition from manual SQL and raw strings with the advent of jOOQ. <!-- SC_ON --> submitted by /u/Mirko_ddd (https://www.reddit.com/user/Mirko_ddd)
[link] (https://mirko-ddd.medium.com/regex-are-not-the-problem-strings-are-6e8bf2b9d2db) [comments] (https://www.reddit.com/r/programming/comments/1sfnk1y/regex_are_not_the_problem_strings_are/)
https://www.reddit.com/r/programming/comments/1sfnk1y/regex_are_not_the_problem_strings_are/
<!-- SC_OFF -->I think it is a point of view that may seem controversial but it traces a historical precedent that is quite shareable (the Joda-Time case) and how it could be applied to the world of regular expressions, a bit like the transition from manual SQL and raw strings with the advent of jOOQ. <!-- SC_ON --> submitted by /u/Mirko_ddd (https://www.reddit.com/user/Mirko_ddd)
[link] (https://mirko-ddd.medium.com/regex-are-not-the-problem-strings-are-6e8bf2b9d2db) [comments] (https://www.reddit.com/r/programming/comments/1sfnk1y/regex_are_not_the_problem_strings_are/)
Understand ARP in byte level
https://www.reddit.com/r/programming/comments/1sfnxmi/understand_arp_in_byte_level/
submitted by /u/its_justme27 (https://www.reddit.com/user/its_justme27)
[link] (https://prayush.hashnode.dev/build-an-arp-toolkit-attack-and-detection-in-c) [comments] (https://www.reddit.com/r/programming/comments/1sfnxmi/understand_arp_in_byte_level/)
https://www.reddit.com/r/programming/comments/1sfnxmi/understand_arp_in_byte_level/
submitted by /u/its_justme27 (https://www.reddit.com/user/its_justme27)
[link] (https://prayush.hashnode.dev/build-an-arp-toolkit-attack-and-detection-in-c) [comments] (https://www.reddit.com/r/programming/comments/1sfnxmi/understand_arp_in_byte_level/)
Safer Casting in C β With Zero Runtime Cost
https://www.reddit.com/r/programming/comments/1sfomcl/safer_casting_in_c_with_zero_runtime_cost/
submitted by /u/Yairlenga (https://www.reddit.com/user/Yairlenga)
[link] (https://medium.com/@yair.lenga/safer-casting-in-c-with-zero-runtime-cost-making-casts-visible-auditable-and-harder-to-misuse-331b3a3a8090) [comments] (https://www.reddit.com/r/programming/comments/1sfomcl/safer_casting_in_c_with_zero_runtime_cost/)
https://www.reddit.com/r/programming/comments/1sfomcl/safer_casting_in_c_with_zero_runtime_cost/
submitted by /u/Yairlenga (https://www.reddit.com/user/Yairlenga)
[link] (https://medium.com/@yair.lenga/safer-casting-in-c-with-zero-runtime-cost-making-casts-visible-auditable-and-harder-to-misuse-331b3a3a8090) [comments] (https://www.reddit.com/r/programming/comments/1sfomcl/safer_casting_in_c_with_zero_runtime_cost/)
I Am Very Fond of the Pipeline Operator
https://www.reddit.com/r/programming/comments/1sfoqwq/i_am_very_fond_of_the_pipeline_operator/
submitted by /u/techne98 (https://www.reddit.com/user/techne98)
[link] (https://functiondispatch.substack.com/p/i-am-very-fond-of-the-pipeline-operator) [comments] (https://www.reddit.com/r/programming/comments/1sfoqwq/i_am_very_fond_of_the_pipeline_operator/)
https://www.reddit.com/r/programming/comments/1sfoqwq/i_am_very_fond_of_the_pipeline_operator/
submitted by /u/techne98 (https://www.reddit.com/user/techne98)
[link] (https://functiondispatch.substack.com/p/i-am-very-fond-of-the-pipeline-operator) [comments] (https://www.reddit.com/r/programming/comments/1sfoqwq/i_am_very_fond_of_the_pipeline_operator/)
Implementing C++ STL containers in pure C β what I learned
https://www.reddit.com/r/programming/comments/1sg1apu/implementing_c_stl_containers_in_pure_c_what_i/
<!-- SC_OFF -->I've been experimenting with implementing C++ STL-style containers (vector, list, deque, set, map, stack, queue, priority_queue, unordered_set, unordered_map) as a single-header C library using C99 macros and variadic dispatch. The goal was to see how close you can get to the C++ STL interface in pure C β same function names like push_back, insert, erase, find, begin/end β without requiring a C++ compiler. A few interesting design challenges came up: 1. Bracket access (v[i]) For VECTOR and DEQUE, the handle is just a * pointing into the data region, so v[i] works naturally as pointer arithmetic. Metadata (size, capacity) is stored before the pointer address. This also means you can pass a vector directly to qsort or bsearch with no wrapper. ```c VECTOR(int) v = new_vector(int); for (int i = 0; i < 10; i++) push_back(v, i); qsort(v, size(v), sizeof(int), my_cmp); // just works printf("%d", v[3]); // bracket access destroy(v); ``` 2. Variadic overloading in C Using macro argument counting, different parameter counts dispatch to different behaviors: c insert(v, v + 3, 777); // insert single value at position insert(v, v + 5, 3, 999); // insert N copies at position This mimics C++ overloading without _Generic per se β it's purely preprocessor-driven dispatch based on argument count. 3. Uniform API across container types The same insert, erase, find names work across all container types. A single macro routes to the correct implementation based on the container's internal tag. Node-based containers (list, set, map) use next(it) / prev(it) for iteration instead of it++. ```c // Dijkstra with VECTOR + PRIORITY_QUEUE typedef struct { int cost, to; } Edge; int compare_edge(const void a, const void *b) { return ((Edge)a)->cost > ((Edge)b)->cost ? -1 : ((Edge)a)->cost < ((Edge*)b)->cost; } int dijkstra(Edge *graph, int src) { VECTOR(int) dist = new_vector(int); QUEUE(Edge) pq = new_priority_queue(Edge, compare_edge); assign(dist, size(graph), 99999); dist[src] = 0; push(pq, (Edge){0, src}); while (!empty(pq)) { Edge e = top(pq); pop(pq); for (int i = 0; i < size(graph[e.to]); i++) { int next_to = graph[e.to][i].to; int new_cost = dist[e.to] + graph[e.to][i].cost; if (dist[next_to] > new_cost) { dist[next_to] = new_cost; push(pq, (Edge){new_cost, next_to}); } } } destroy(pq); return dist; } ``` Compiler compatibility was another rabbit hole β getting this to work across MSVC, GCC, Clang, MinGW64, icx-cc, and TCC required quite a bit of conditional preprocessing, especially around __VA_ARGS__ handling differences. Source is here if anyone wants to look at the macro internals: https://github.com/springkim/OpenCSTL Curious what people think about this approach. Has anyone else tried building STL-like abstractions in C? What tradeoffs did you hit? I'm especially interested in opinions on the metadata-before-pointer trick for bracket access β it works well but feels a bit cursed. <!-- SC_ON --> submitted by /u/springnode (https://www.reddit.com/user/springnode)
[link] (https://github.com/springkim/OpenCSTL) [comments] (https://www.reddit.com/r/programming/comments/1sg1apu/implementing_c_stl_containers_in_pure_c_what_i/)
https://www.reddit.com/r/programming/comments/1sg1apu/implementing_c_stl_containers_in_pure_c_what_i/
<!-- SC_OFF -->I've been experimenting with implementing C++ STL-style containers (vector, list, deque, set, map, stack, queue, priority_queue, unordered_set, unordered_map) as a single-header C library using C99 macros and variadic dispatch. The goal was to see how close you can get to the C++ STL interface in pure C β same function names like push_back, insert, erase, find, begin/end β without requiring a C++ compiler. A few interesting design challenges came up: 1. Bracket access (v[i]) For VECTOR and DEQUE, the handle is just a * pointing into the data region, so v[i] works naturally as pointer arithmetic. Metadata (size, capacity) is stored before the pointer address. This also means you can pass a vector directly to qsort or bsearch with no wrapper. ```c VECTOR(int) v = new_vector(int); for (int i = 0; i < 10; i++) push_back(v, i); qsort(v, size(v), sizeof(int), my_cmp); // just works printf("%d", v[3]); // bracket access destroy(v); ``` 2. Variadic overloading in C Using macro argument counting, different parameter counts dispatch to different behaviors: c insert(v, v + 3, 777); // insert single value at position insert(v, v + 5, 3, 999); // insert N copies at position This mimics C++ overloading without _Generic per se β it's purely preprocessor-driven dispatch based on argument count. 3. Uniform API across container types The same insert, erase, find names work across all container types. A single macro routes to the correct implementation based on the container's internal tag. Node-based containers (list, set, map) use next(it) / prev(it) for iteration instead of it++. ```c // Dijkstra with VECTOR + PRIORITY_QUEUE typedef struct { int cost, to; } Edge; int compare_edge(const void a, const void *b) { return ((Edge)a)->cost > ((Edge)b)->cost ? -1 : ((Edge)a)->cost < ((Edge*)b)->cost; } int dijkstra(Edge *graph, int src) { VECTOR(int) dist = new_vector(int); QUEUE(Edge) pq = new_priority_queue(Edge, compare_edge); assign(dist, size(graph), 99999); dist[src] = 0; push(pq, (Edge){0, src}); while (!empty(pq)) { Edge e = top(pq); pop(pq); for (int i = 0; i < size(graph[e.to]); i++) { int next_to = graph[e.to][i].to; int new_cost = dist[e.to] + graph[e.to][i].cost; if (dist[next_to] > new_cost) { dist[next_to] = new_cost; push(pq, (Edge){new_cost, next_to}); } } } destroy(pq); return dist; } ``` Compiler compatibility was another rabbit hole β getting this to work across MSVC, GCC, Clang, MinGW64, icx-cc, and TCC required quite a bit of conditional preprocessing, especially around __VA_ARGS__ handling differences. Source is here if anyone wants to look at the macro internals: https://github.com/springkim/OpenCSTL Curious what people think about this approach. Has anyone else tried building STL-like abstractions in C? What tradeoffs did you hit? I'm especially interested in opinions on the metadata-before-pointer trick for bracket access β it works well but feels a bit cursed. <!-- SC_ON --> submitted by /u/springnode (https://www.reddit.com/user/springnode)
[link] (https://github.com/springkim/OpenCSTL) [comments] (https://www.reddit.com/r/programming/comments/1sg1apu/implementing_c_stl_containers_in_pure_c_what_i/)
I learned something about GPUs today
https://www.reddit.com/r/programming/comments/1sk9bhg/i_learned_something_about_gpus_today/
submitted by /u/rogual (https://www.reddit.com/user/rogual)
[link] (https://foon.uk/blackshift-sand-bug/) [comments] (https://www.reddit.com/r/programming/comments/1sk9bhg/i_learned_something_about_gpus_today/)
https://www.reddit.com/r/programming/comments/1sk9bhg/i_learned_something_about_gpus_today/
submitted by /u/rogual (https://www.reddit.com/user/rogual)
[link] (https://foon.uk/blackshift-sand-bug/) [comments] (https://www.reddit.com/r/programming/comments/1sk9bhg/i_learned_something_about_gpus_today/)