Reddit Programming
199 subscribers
1.22K photos
126K links
I will send you newest post from subreddit /r/programming
Download Telegram
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/)
[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/)
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/)
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/)