uk
Feedback
C++ - Reddit

C++ - Reddit

Відкрити в Telegram

Stay up-to-date with everything C++! Content directly fetched from the subreddit just for you. Join our group for discussions : @programminginc Powered by : @r_channels

Показати більше
229
Підписники
Немає даних24 години
Немає даних7 днів
+130 день
Архів дописів
Join the creation of a library that fixes C++'s problems C++ has a lot of serious problems, and instead of fixing them, many people are switching to other languages like Rust, Zig, or Carbon. But I believe we should try to improve C++ from the inside, rather than abandon it. Some of the core issues in C++: - Lack of safety by default (null pointers, out-of-bounds access, lifetime issues) - Implicit type conversions that often lead to subtle and hard-to-find bugs The good news: the issue with implicit conversions is already solved in the core types of this library — they prevent unintended conversions, unlike many types in the standard library. My proposal: stds — a modern alternative to the C++ standard library I’ve started a project called stds to address these issues by rethinking the standard library from the ground up. The goal is to build safer, clearer, and more consistent types while staying inside the C++ ecosystem. The library is planned to be developed for C++17 and higher, but this may change. The library avoids relying on the standard C++ library as much as possible and only uses C where necessary. It aims to make C++ safer and more ergonomic without changing the language itself. What’s already implemented: - ptr: a smart pointer with null and validity checks - array: a bounds-safe fixed-size array - Experimental versions of string and dynamic_array Planned features: - locale support - Better date/time APIs (as an alternative to chrono) - Safer I/O interfaces (replacements for cin, cout, fstream) - Modern string formatting utilities - Lightweight concurrency tools (tasks, coroutines, etc.) - Improved containers and algorithms Everyone is welcome to join Whether you want to write code, suggest ideas, test features, or give feedback — you’re welcome. This is a community-driven project, and any help is appreciated. GitHub repo: https://github.com/artem0011011000111001/stds Let’s try to make C++ better — from within. https://redd.it/1k0lfx3 @r_cpp

Error in Effective Modern C++ (even template constructor suppresses default constructor generation) In "Effective Modern C++" on page 117, Item 17, "Things to remember" it is written "Member function templates never suppress generation of special member functions." That is not so - if there is any user-defined constructor (even template one), default one is not generated: Source code example: class Widget {     public:         template<typename T>         Widget(const T& rhs){}; }; int main() {     // Fails - no default constructor     // Commenting out template constructor makes it compile without errors     Widget w; } I've sent e-mail about this to the author Scott Meyers, he answered really quick: >... I suggest you post your observation to a C++ discussion forum to see what others have to say. If you get significant backup that the text in my book is incorrect, I will seriously consider adding it to the book's errata list. So if you have time please support or tell me that I'm wrong :) Thanks for your attention. https://redd.it/1k0cl5j @r_cpp

Enance-Amamento, a C++ Signed Distance Fields library Hi all, I recently released as public a project I have been working on for a while. https://github.com/KaruroChori/enance-amamento It is a C++ library for Signed Distance Fields, designed with these objectives in mind: Run everywhere. The code is just modern C++ so that it can be compiled for any platform including microcontrollers. No shader language duplicating code nor graphic subsystem needed. Support multiple devices. Being able to offload computation on an arbitrary number of devices (GPUs or the CPU itself) thanks to OpenMP. Customizable attributes to enable arbitrary materials, spectral rendering or other physical attributes. Good characterization of the SDF, like bounding boxes, boundness, exactness etc. to inform any downstream pipeline when picking specific algorithms. Several representations for the SDF: from a dynamic tree in memory to a sampled octatree. 2D and 3D samplers, and demo pipelines. The library ships with a demo application which loads a scene from an XML file, and renders it in real-time (as long as your gpu or cpu is strong enough). The project is still in its early stages of development. There is quite a bit more to make it usable as an upstream dependency, so any help or support would be appreciated! Especially if you can test AMD gpus since I have none :). https://redd.it/1k0ai35 @r_cpp

How do you deal with performance overhead from interface-based abstractions in layered architectures? I’ve been structuring a system using a layered architecture where each layer is abstracted using interfaces to separate concerns, abstraction and improve maintainability. As expected, this introduces some performance overhead — like function call indirection and virtual function overhead. Since the system is safety critical and needs to be lets say MISRA complaint, I’m trying to figure out the best practices for keeping things clean without compromising on performance or safety. https://redd.it/1k038b1 @r_cpp

Why doesn't a defaulted <=> operator implicitly declare both != and == operators, rather than just ==? Reading up on default comparison operators, I recently noticed: > If a class C does not explicitly declare any member or friend named operator==, an operator function is declared implicitly for each operator<=> defined as defaulted. Each implicity-declared operator== have the same access and function definition and in the same class scope as the respective defaulted operator<=>, with the following changes: > The declarator identifier is replaced with operator==. > The return type is replaced with bool. Makes sense. But why doesn't it also implicitly declare a defaulted operator!= as well? Why doesn't it declare the rest of the comparison operators, since they can also be defined in terms of <=>? And as I was writing this up, it seems like VS2022 does implicitly generate at least operator== and operator!= when there is a defaulted operator<=>. Is that non-standard? https://redd.it/1k01um5 @r_cpp

Rate my skills hello, i am new to c++, i have been developing it from 4 months, so i want you to rate my skills(till now) from this code std::vector<std::string> listedDevices() { auto cleanup = [\](const char* NAME) -> std::string { std::string name(NAME); const std::string preffix = "rpcap://"; if (name.find(preffix) == 0) { name = name.substr(preffix.length()); } return name; }; pcap_if_t* d; if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL, &devs, errbuff) == -1) { std::cerr << "Error finding devices\\n"; exit(1); } if (devs == nullptr) { std::cerr << "No devices"; } else { for (d = devs; d != NULL; d = d->next) { interfaces.push_back(cleanup(d->name)); } } return interfaces; } and please be toxic as hard as you can XD https://redd.it/1jzr5yg @r_cpp

Numerical Relativity 104: How to build a neutron star - from scratch https://20k.github.io/c++/2025/04/15/nr104.html https://redd.it/1jzotad @r_cpp

Which libraries to use to create HTTP server on modern C++ (17) I want to build a HTTP server in C++17 (using modern c++ practices) to practice the language and learn about networking in general. I have studied the theory on how a HTTP server works, tcp/ip protocol, client-server, etc... Now, I will start coding, but I have a doubt about which library (or libraries) should I use for handling socket operations and http connection. https://redd.it/1jzfkc1 @r_cpp

Hex++, Cargo inspired C++ "Project manager" Hello fellow C++ enjoyers, i'm a second year software engineering student and been learning C++ for the time. The lack of "centralized" tools or the cargo styled experience was bothering me a bit, so I wrote my own implementation of these C++ tools come together for myself and decided to make it public if anyone sees use in it. If interested and have some extra time, go take a look and drop your thoughts / critique https://github.com/Katacc/hexpp https://redd.it/1jzevjf @r_cpp

How to stop over engineering trivial code Hey all, Ive been programming C++ for like 5 years now and I like to think it’s my favorite language but it’s really giving me a run for my money. And the reason is is because of OOP. I’m just so C brained I can’t fucking get this goddamn shit and it made me so mad I just deleted my entire Minecraft clone project that I’ve been working on for months because it’s so over complicated i am going fucking insane. I want to write clean elegant code like people like the Cherno that’s really heavy OOP, as in everything being a class, heavy encapsulation, decoupling everything that can be decoupled, using composition and inheritance when needed, but it’s just amassed into a flaming piece of fucking ass shit and I’m so mad at myself because I can’t figure it out. Should I just switch back to C? Like do some people just get OO concepts and clean code concepts better than others? I just prefer a procedural or functional approach but I want to like OOP. How do I stop this madness!!! https://redd.it/1jzclwy @r_cpp

New C++ Conference Videos Released This Month - April 2025 (Updated to Include Videos Released 2025-04-07 - 2025-04-13) **CppCon** 2025-04-07 - 2025-04-13 * Lightning Talk: C++ and Rust Bindings - Mixing It Best With CMake - Damien Buhl - [https://youtu.be/EcbmDXA4Inc](https://youtu.be/EcbmDXA4Inc) * Lightning Talk: Every Use Case of Colon and Ellipses in C++ - Ali Almutawa Jr - [https://youtu.be/1blspAWnjUQ](https://youtu.be/1blspAWnjUQ) * Lightning Talk: Do You Love or Hate Your C++ Build System? - Helen Altshuler - [https://youtu.be/jBnQ69ZMtHw](https://youtu.be/jBnQ69ZMtHw) * Lightning Talk: Generative C++ - Alon Wolf - [https://youtu.be/y8NXF7WsSEc](https://youtu.be/y8NXF7WsSEc) * Lightning Talk: Remote Execution Caching Compiler (RECC) for C++ Builds - Shivam Bairoliya - [https://youtu.be/oH1JKMKwDDA](https://youtu.be/oH1JKMKwDDA) 2025-03-31 - 2025-04-06 * Lightweight Operator Fusion Using Data-Centric Function Interfaces in C++ - Manya Bansal - [https://youtu.be/pEcOZDRXhNM](https://youtu.be/pEcOZDRXhNM) * Security Beyond Memory Safety - Using Modern C++ to Avoid Vulnerabilities by Design - Max Hoffmann - [https://youtu.be/mv0SQ8dX7Cc](https://youtu.be/mv0SQ8dX7Cc) * To Int or to Uint, This is the Question - Alex Dathskovsky - [https://youtu.be/pnaZ0x9Mmm0](https://youtu.be/pnaZ0x9Mmm0) * Leveraging C++ for Efficient Motion Planning: RRT Algorithm for Robotic Arms - Aditi Pawaskar - [https://youtu.be/CEY4qRLcLmI](https://youtu.be/CEY4qRLcLmI) * Guide to Linear Algebra With the Eigen C++ Library - Daniel Hanson - [https://youtu.be/99G-APJkMc0](https://youtu.be/99G-APJkMc0) **Audio Developer Conference** 2025-04-07 - 2025-04-13 * Intro to Software Development of Audio Devices - From Plugins to Hardware - Wojtek Jakobczyk - [https://youtu.be/eqHaiV5uNnM](https://youtu.be/eqHaiV5uNnM) * Teaching Audio Developers How to Build AI-Enhanced Audio Plugins - Matthew Yee-King - [https://youtu.be/Uy7BXe9crUM](https://youtu.be/Uy7BXe9crUM) * Expanding SDKs and APIs in Pro Tools - Dave Tyler - [https://youtu.be/v31yooYnvYs](https://youtu.be/v31yooYnvYs) 2025-03-31 - 2025-04-06 * Workshop: Designing and Developing an AVB/Milan-Compliant Audio Network Endpoint - Fabian Braun - [https://youtu.be/Xs0UvCOjpnU](https://youtu.be/Xs0UvCOjpnU) * JUCE and Direct2D - Matt Gonzalez - [https://youtu.be/7qepqLo5bGU](https://youtu.be/7qepqLo5bGU) * Intro to Software Development of Audio Devices - From Plugins to Hardware - Wojtek Jakobczyk - [https://youtu.be/eqHaiV5uNnM](https://youtu.be/eqHaiV5uNnM) **C++ Under The Sea** 2025-03-31 - 2025-04-06 * BJÖRN FAHLLER - Cache-friendly data + functional + ranges = ❤️ - [https://www.youtube.com/watch?v=QStPbnKgIMU](https://www.youtube.com/watch?v=QStPbnKgIMU) https://redd.it/1jz1zww @r_cpp

delete vs. ::delete A colleague made me aware of the interesting behavior of `delete` vs `::delete`, see https://bsky.app/profile/andreasbuhr.bsky.social/post/3lmrhmvp4mc2d In short, `::delete` only frees the size of the base class instead of the full derived class. (Un-)defined behavior? Compiler bug? Clang and gcc are equal - MSVC does not have this issue. Any clarifying comments welcome! https://redd.it/1jyzuuf @r_cpp

I made a FAST File Explorer in C++ Check out the File Explorer with GUI I made in C++: https://www.youtube.com/watch?v=Jk4vkr6vP38 https://redd.it/1jyy1k2 @r_cpp

is there any alternative of replit for cloud coding service? tried some of them like codesandbox but none of them had C or C++ https://redd.it/1jyoc5t @r_cpp

Strengthening the brand Quite regularly we get posts like this one https://www.reddit.com/r/cpp/s/6fic54ootF asking about C++ for web development. From a language envangelist point of view its quite depressing to see the usual top 5 or more posts being "use something else". There are various libraries and frameworks which make it reasonable and wasm too. So why not. You would never hear such downtalking on r/rust Okay right tool for the right job and all that but ignoring that for now what does the language need to really strengthen is position in this? https://redd.it/1jydro4 @r_cpp

Function overloading is more flexible (and more convenient) than template function specialization https://devblogs.microsoft.com/oldnewthing/20250410-00/?p=111063 https://redd.it/1jye360 @r_cpp