fa
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

نمایش بیشتر
228
مشترکین
اطلاعاتی وجود ندارد24 ساعت
اطلاعاتی وجود ندارد7 روز
+630 روز
آرشیو پست ها
Please support me Hello everyone i am junior developer plz support my first C++ project on github https://github.com/Huinapalochke/Simple-Walking-game make some maps \^.\^ https://redd.it/1ts25z7 @r_cpp

Free code camp 31 hours c++ tutorial So I'm an absolute beginner in programming, starting with C++ as I aspire to do competitive programming. I just want to know, is it worth watching? Or I can use the Bro Code 6 hr tutorial, although I think many topics aren't covered. Bro Code mentioned it. Or any other good resources you can recommend . Also If I start with free code camp tutorial then how many days it will take to complete? https://redd.it/1trwkyu @r_cpp

ARB v1.0: A C++23 Articulated Rigid-Body Dynamics Library for Computer Graphics Hi r/cpp, I’ve just released v1.0 of ARB, a modern, lightweight, header-only C++23 library for articulated rigid-body dynamics aimed primarily at computer graphics and robotics applications. The library is intended to provide a clean and simple tool for prototyping and rapid development of rigid-body dynamics applications without the complexity and overhead of the larger physics engines  out there. ARB is based on a differentiable spatial algebra which is used to implement  the articulated body algorithms ABA and RNEA.  ARB supports end-to-end differentiation which enables advanced techniques such as system identification, gradient based optimisation, and machine learning. The lib also  provides collision detection/resolution using GJK/EPA, and has URDF support for model import/export. My main interest here is in getting some feedback from C++ developers  about ARB syntax and API design.  Is it easy to use? Are there any features you think are missing? I've used C++23 - should I use C++20? Available here: ARB https://redd.it/1trvt4r @r_cpp

C++: The Documentary TRAILER | COMING JUNE 4th https://youtube.com/watch?v=NXwTRzywDSk https://redd.it/1trtlqo @r_cpp

Better C++ Meetup preview on SwedenCpp , shows now online, hybrid or in person https://www.swedencpp.se/meetups https://redd.it/1trtr7u @r_cpp

Reimplementation of Toyota MVCI32 in C++ as OpenMVCI https://github.com/AADI-Diagnostics/openmvci https://redd.it/1trnqvv @r_cpp

Simple C89 object pool (fixed-size, O(1) alloc/free, no heap fragmentation) https://github.com/xyurt/object-pool https://redd.it/1trkvd5 @r_cpp

miniaudio compile times i found this library called miniaudio, however instead of having precompiled dll files, its just the header and then the c file that really only includes the header, the header file has all of the definitions and declarations of everything in the library, it makes the compile times take a lot of time, can i compile the header file to a dll the c file is literally just: #define MINIAUDIO_IMPLEMENTATION #include "miniaudio/miniaudio.h" and the header file is like 4 megabytes https://redd.it/1trk8yn @r_cpp

Cup: a build system implemented in C that uses C as its scripting language. https://github.com/howaajin/cup https://redd.it/1trgx34 @r_cpp

that any compiler-specific assumptions are exposed and resolved. ## 10. Separation of Datasets for Unit Testing vs. Hardware Profiling To support high-velocity AI development, separate datasets used for unit/functional testing from datasets used for CPU/hardware profiling via configuration files. Unit/Functional Test Dataset Configuration Points exclusively to static, verified testing sample assets bundled with the project repository. Keeps unit test runs fast, deterministic, and independent of external user directories. Hardware Profiling Dataset Configuration Points to a high-volume, real-world data directory to ensure the execution runs long enough to capture abundant, high-precision hardware profiling samples essential for generating Roofline Models and thread diagnostics. This prevents the AI from corrupting local test fixtures or running infinite loops during local testing runs. ## 11. One-Click Profiling Speculative optimization is a trap, and here is an excellent usage of AI. Use AI to interpret and reason your profiling results. An project should have a structured, friction-free way to be one-click profiled directly from the IDE. AI agent can be given screen shots of profilers gui to assist with improvements. Achieve this using custom build targets that compile and launch profiling suites sequentially, binding them to distinct diagnostic tools: Low-Level Hardware Profiling (Linux \`perf\`) Exposes cache misses, instruction counts, context switching, and branch mispredictions directly within the IDE console. Parallel Scaling & Threading Intel VTune Maps worker thread utilization and lock contention timelines. Vectorization & Roofline Analysis Intel Advisor) Maps execution scaling against the hardware memory-bound or compute-bound limits, routing compiler optimization reports directly to source lines. Baking profiling targets directly into the build graph eliminates manual setup overhead, allowing AI agents to profile builds with a single command. ### 12. Conclusion Ultimately, a project that is good for humans is good for AI mixed work. If a project is structured to make a human's life easier—with strict compiler warning gates, name symmetry, hardened STL assertions, cross-compiler verification pipelines, and one-click profiling—it becomes an ideal environment for AI integration. The AI can then be safely used to accelerate design explorations, write initial unit tests, and write boilerplate code, while your automated, ultra-strict build verification suite acts as an uncompromising filter. But true solo C++ AI development? Forget about it. C++ is too complex, has too many silent pitfalls, and requires too much deep architectural alignment. Until AIs can reason about memory layout, cache coherency, and compile-unit boundaries, keep a human in the driver's seat with a robust CMake verification suite in the engine room. https://redd.it/1trfnq5 @r_cpp

icpx. A warning missed by one compiler is routinely caught by another. And forcing warning-as-errors across multiple compilers ensures that subtle cross-platform compilation anomalies are caught long before merging. There is a plethora of warning options available across different compilers. Use your AI assistant to educate you on which warnings should be utilized for different build types (such as Debug, Sanitizers, Release, and Deep Debug) to maximize static analysis safety without generating redundant noise. ## 6. Dynamic Sanitizers Net (Clang & GNU) AIs are prone to memory-safety errors, data races, and undefined behavior when writing custom resource tracking or concurrency. Define and use specialized build configurations for every major sanitizer. GCC and Clang implement address and undefined behavior check features differently, and their standard libraries have varying layouts. Running both compiler toolchains with sanitizers guarantees that memory alignment, library linkage anomalies, and ABI violations are fully caught under both GNU and LLVM environments. Clang Sanitizers AddressSanitizer: Tracks memory bounds and lifetimes (catches buffer overflows, use-after-free). MemorySanitizer: Detects uninitialized memory reads. ThreadSanitizer: Detects concurrent data races. UndefinedBehaviorSanitizer: Catches general Undefined Behavior. LeakSanitizer: Catches memory leaks. GNU (GCC) Sanitizers AddressSanitizer: Captures memory violations within GCC compilation chains. UndefinedBehaviorSanitizer: Catches undefined behavior compiled via GCC. ## 7. Integrated Static Analysis Policy Static analysis is baked directly into Cmake compilation target properties. This can both be configured to run on demand and checking rule violations during compilation. Classify compiler warnings and linter outputs into distinct categories: Category A Safety-Critical & Structural Explicit Checks (e.g. disallowing implicit boolean conversions and requiring explicit namespace closing comments). Category B Situational Design Warnings. Category C Stylistic Noise. Require the AI agent to resolve Category A: Safety-Critical Checks by default in every build. For Category B and C warnings, rather than ignoring them or letting them clutter the build logs, they should be automatically formatted into a generated report web page. This nice formatted report contains the code warnings alongside technical reasoning and clickable links directly to the offending lines of code. This gives human developers a central audit page where they can review low-priority warnings in context, rather than having to read raw linter command-line logs. ## 8. The Dual-Preset Strategy To balance high-performance local optimization with absolute portability that is needed for high velocity AI supported code bases, utilize a dual-preset design scheme using Cmake build presets: Custom Presets (Development) Tailored specifically for local development builds with profiling and hardware optimization. It specifies directives such as: Native Optimization Maximize vectorization and processor performance by tailoring compilation to the host machine's active CPU architecture. Sanitizer bindings Applies all custom runtime diagnostic architectures. Default Presets (Consumers of the project) Sets absolutely no custom compiler flags, relying entirely on Cmake provided and compiler-native standard build types to ensure the project remains portable to consumers. A project should use both, testing builds ofc using with custom presets in the development phase, but also test and build using default Cmake build preset builds. ## 9. Unified Build & Test Workflows To simplify cross-compiler testing, utilize build workflow presets to chain the entire compilation lifecycle in a single invocation: Configure -> Build -> Test. Use a verification script that kicks off and automates verification across all available compiler pipelines sequentially (GNU, oneAPI, Clang). Let the AI agent compare build outputs across compilers to ensure

AI<->Human C++ My project rules to Stop GenAI from ruining code. I want to share what i believe a C++ project structure should use and explain why I believe this setup is an must in a mixed active AI driven project. Let's make one thing clear first: best practices are best practices it does not matter what is generating the code. Whether you are a human developer typing every line or pair programming with a generative AI, the same rules apply. I am highly skeptical of solo C++ AI projects. When you let a GenAI write a large C++ codebase on its own, it inevitably hallucinates legacy styles, triggers silent memory bugs, violates copy/move resource rules, and generates chaotic global build system configurations that leak state everywhere. But mixed AI-human workflow is awesome. Humans can produce bad code sure, but at the high velocity of gen AI, we humans have very little chance to code review at same pace. I AI mixed project must surround the coding process with an automated, multi-layered, ultra-strict diagnostic net. If the project's build and verification framework is robust, it acts as a filter that (instantly) catches, isolates, and flags bugs—whether introduced by an AI or not. Below is not new or revolutionary, but best practices needs to be repeated again and again when gen AI is one click away in every modern IDE. ## 1. Limiting Visibility for AI Agents via Ignore Rules Before you even compile, you need to prevent the AI agent from being overwhelmed by your project's workspace. Letting an agent scan massive build directories, binary assets, or internal IDE files wastes its context window, dilutes its attention, and causes it to hallucinate bad code references. Use an agent ignore file which agent search tools inherit, in it hide dynamically generated files, heavy database files, and media folders. Generally, you should filter out: Dynamic compile directories and build output folders. IDE metadata directories and user preference configs. Heavy binary databases and serialization outputs. Large media assets, zipped files, and static binary templates. Limiting what the AI can see ensures it remains focused on the exact translation units it is meant to write or refactor. ## 2. The Symmetry Principle: Directory == Target == Translation Unit GenAI frequently generates chaotic Cmake build configurations, for example polluting global scopes with legacy commands that include directories globally. This leads to state leakage, long compile times, and header name collisions. To block this, modern Cmake build systems should enforce target-centric directory symmetry. In a symmetry principle project, knowing the folder name foo guarantees that: The target name is foo. The source file is foo.cpp. The header path is foo/foo.hpp. The internal dependency link target is ${PROJECT_NAME}::foo ## 3. Strict C++ & Build Standards, Agent Skill Files To keep both human developers and AI agents aligned, document architectural coding rules inside dedicated skills directory. Provide an AI agent with clear, version-controlled skill descriptions prevents it from guessing coding standards and ensures it outputs highly compatible, project-specific code by default. Do this for each language, C++, Cmake, python etc. ## 4. Severe Standard Library Hardening, a Debug Complement. GenAI produces logic bugs involving container lifetimes, such as iterator invalidation (mutating a collection while looping over it) and off-by-one errors inside standard arrays. To trap these, use Cmake build presets that uses deep debug levels that uses internal standard library diagnostic assertions. When the AI writes code that invalidates iterators under a hardened run, instead of silently corrupting memory or producing non-deterministic bugs, the application triggers a clean, immediate runtime abort with a stack trace. Severe hardening is a complement to a normal debug builds, not an either-or. ## 5. Compiler Warning Gates Always build with every compiler you can in my case GCC, Clang, Intel

I built a C++23 engine that treats simulated worlds like Git commits https://github.com/farukalpay/Pointerverse/ https://redd.it/1tr8rvv @r_cpp

C or Cpp In Ethical Hacking/Cyber-Security Since a month I am hearing that C is required for Memory Management. Also, Linux and many operating system are written In C. But, I am still In a doubt.. If C++ as an extension of C then It's Obvious C++ Inheritis all the properties of C. Then learning C++ Is like Learning C side by side. Why Not people Encourage this approach? Any Reason? And, Does C permits the developer to access Unpermitted Files than of Python? From 1 June — 30 June, I aimed to Learn C, since I know the basics of C++ as well as I already Learn Python So applying logic to Experiment Output would be fast, Right? Last, I am Truly Aiming to learn C at least for my Career Beginning In Linux. Is There any Vast Use of C or just Memory Handling? https://redd.it/1tr3sjv @r_cpp

libjdk is a comprehensive C++ implementation of the Java Development Kit (JDK), providing native C++ libraries that mirror the functionality of Java's core libraries and modules https://github.com/libjdk/libjdk https://redd.it/1tqzlx2 @r_cpp

Why are C++ keywords so heavily dependent on context??? Like what do you mean inline can also be used to declare "global" variables!? I would happily accept a different keyword, inline just makes no sense here... even static would have been understandable but instead it creates private instances in each translation unit T_T https://redd.it/1tqu643 @r_cpp

A C++20 full-text search engine I've been building in the open. Same shape as Lucene/Tantivy, but written to fit cleanly into a C++ codebase — no JVM, no JNI, no FFI tax. Repo: https://github.com/evilmucedin/SearchPlusPlus A few engineering decisions worth calling out (most of the design is in https://redd.it/1tqodnm @r_cpp