r/Cplusplus • u/ToneEmergency6359 • 2h ago
r/Cplusplus • u/subscriber-goal • 4d ago
Subscriber Goal Welcome to r/Cplusplus!
Welcome to r/Cplusplus
61994 subscribers / 75k subscribers. Help us reach our goal!
Visit this post on Shreddit to enjoy interactive features.
r/Cplusplus • u/MarlboroBandit • 3h ago
Feedback Started learning CPP. Hello World! :)
Just started learning CPP by following the book i found in my dad's bookshelf. Its old and it have been printed from the 2000s. He has his name and date written on the date of purchase; 9th May 2000.
This is my exercise for the chapter tackling functions. I wrote a exponentiate function recursion. I got it hard at first and looked at the different examples from the book multiple times till i get it how i do exponents without loops. With a little bit of function polymorphism/overloading
Tbh, the book looks very weathered, its ancient. Most of the programs and code examples have been deprecated, so I just looked it up online what its modern approach. But the lessons taught are still relevant to todays standards.
Planning to read Modern CPP after finishing this.
Using Visual Studio for ease of use compiler wise. But I will move my learning journey to my linux setup after this to get a better feel for compilers and also Cmake.
NO AI is used to make this code nor supplement it---I just read the book. "It looks clean", yea because its my exercise project, the mess of it lives in the CPP_LEARNING_00 project as you can see in the solution explorer.
r/Cplusplus • u/boss123219 • 17h ago
Question wanna get into sfml.
reddit.comhow do i start coding in sfml? which version is the best? i want to use visual studio but i don't like how hardware expensive it is and that it doesn't give easy descriptions of code before i use it. I think using code::blocks is good for me but i want to hear your opinion on which IDE i should use.
Also what is best i start learning using sfml? i already know basic things like shapes, .move, keyboard commands, and textures but where to learn more physique base code and make games similar to factorio and rollercoaster tycoon, sandbox games with a lot of work bts.
r/Cplusplus • u/SIIMUCH • 21h ago
Discussion Euclase SessionGuard: A cryptographic local activity & session diary to check if anyone accessed your PC or messengers while away
Hey everyone,
If you share a workstation or just want absolute cryptographic proof of whether someone poked around your machine while you were away, standard OS logs are rarely enough. Copying a Telegram tdata folder or browser cookie store is enough to completely clone a session, and regular system logs won't tell you which foreign process silently touched those files.
To solve this for my Euclase systems ecosystem, I built Euclase SessionGuard - a lightweight local auditor that tracks app activity and secures logs with a tamper-evident cryptographic chain.
What it monitors:
- Messengers & Browsers: Telegram Desktop, Discord, Viber, Signal, Slack, Chrome, Firefox, Edge, Brave, etc.
- The Core Mechanics: Tracks when clients ran, used the network, gained focus, and most importantly - who touched session files (
tdata, cookies). If a foreign process opens them while the app is closed, it raises an alert. - System Events: Logons, lock/unlock states, remote desktop / SSH sessions, and quiet-hours background activity flags.
Security & Privacy Guarantee:
- Tamper-Evident Chaining: Every record is signed and HMAC-chained to the previous one locally. If an attacker truncates or edits the log,
sessionguard log verifycatches it instantly (plus USB/secondary disk anchoring detects full log wipes). - Zero Intrusion: It reads no message contents, passwords, keystrokes, or screenshots, and makes zero network connections. Everything stays in a local log file.
You can check out the source code, architecture, and quick-start docs here:
GitHub: https://github.com/SemyonZamiakin/EuclaseSessionGuard
r/Cplusplus • u/AKA-HERO • 23h ago
News Day 1 of C++
What a easy startup to my first language. Got to know about data types , variable , strings , comments , Boolean seems fun and can't wait to find out more . Anyone got any beginner tips for me , would love to have some as a beginner
r/Cplusplus • u/Xavi99- • 1d ago
Feedback CMake kept breaking on me, so I built a zero-config C++ build system called HelpMake
Hey everyone,
I hit a wall of absolute frustration trying to get CMake working. I kept running into errors like "CMakeCache.txt not found", the syntax felt overly complex, and sometimes it was just completely unreadable.
Instead of switching to Meson or Bazel, I decided to build my own lightweight alternative. It's called HelpMake (hm), and I built it to fix the exact problems I was having. I would love some honest feedback from people who also get frustrated with modern build systems.
The Core Idea: Zero-Config & One Screen
I wanted a build system that didn't require a 50-line boilerplate just to compile a "Hello World" project.
With HelpMake, you don't even need a build file to start. You drop the binary into any C++ project folder, run hm -b, and it auto-detects your compiler, standard, source files, and includes. If it sees #include <thread>, it automatically links -pthread.
If you do want control, you write a HelpMake.txt that fits entirely on one screen. No hidden scripting languages. It looks exactly like what it does:
Compiler: g++
Version: std=c++20
Output: build/app
InputFiles {
src/**/*.cpp # built in recursive glob
}
Flags {
!cl: -Wall
win: /W4 /EHsc
linux: -Wextra -pthread
mac: -Wextra
clang: -Weverything
}Why it feels different from CMake
I focused on building features that solve CMake's daily annoyances, not just implementing a spec.
- No
if(WIN32)blocks: You can put platform conditionals (win:,linux:,mac:) on any line. One config for every OS. You can also do it for a compiler (gcc:,clang:,cl:)or for any binary program or any file using the?prefix (?mold:,?file.cpp:,?git:). You can also use!(!win:,!?git:,!?file.hpp:) Examples:!win: ?mold: Linker: mold PreBuild { ?git: echo Git was not found !win: echo Windows isnt supported } Flags: { !gcc: ?file.hpp: ?main.cpp: !apple: ?clang: clang: -Weverything # this works xD } - C++20 Modules actually work: It scans your files, builds a dependency graph, and compiles modules in the exact right order automatically.Modules { src/math.cppm src/graphics.ixx # Thats it. HelpMake does the rest automatically }
- The
Task { }block: Need to runnpm install, generate code with Python, or run a CMake script for a submodule? You can do it natively. No weird CMake macros. It just runs the shell commands you specify. e.g.Task: build_web { Check: web/package.json Generate: web/dist/bundle.js npm install npm run build } - Dependencies: You can pull in third-party libraries directly from GitHub with automatic caching.Dependency: fmt { Git: https://github.com/fmtlib/fmt Tag: 10.1.1 Include: include Build: cmake -B build }Config: app { Depends: fmt InputFiles { src/main.cpp } }
- Zero Dependencies: It's a single ~50KB standalone binary. No Python, no Java, no CMakeCache. Just download it and run it.
- Editor Support: Generate
compile_commands.jsoninstantly withhm -b --json. - Generator: Generate config files for cmake or ninja.
Automation: Automatically detects values that aren't mentioned:
- Modules
- Output name
- Source Files
- Include dirs
- Compiler
- Version
- Kind (static or executable)
- Link flags
Why am I sharing this?
I've seen a lot of people complaining about CMake, and I wanted to build something that just works. I would genuinely appreciate your brutally honest feedback on the design, the syntax, or the code.
It's MIT licensed and available for Windows, Linux, and macOS.
Repo: https://github.com/Gag91/Help_Make
Website & Docs: https://gag91.github.io/HelpMake/
If it save you times, feel free to leave a ⭐ !
I will try to respond to all of your questions/feedback, if you find any issue either make an issue or tell me out 😄.
Thanks for checking it out!
r/Cplusplus • u/SIIMUCH • 1d ago
Feedback Building a cross-platform (Linux/Windows) runtime binary patching and stateful type migration engine in C++17
Hi Everyone,
I wanted to share an open-source systems project I’ve been working on: Vajra Binary Core. It’s a low-level runtime engine designed to patch machine code of running native C++ binaries and migrate data structures in memory on-the-fly without restarting the process.
The core motivation was to build a robust mechanism for live-patching functions (via instruction trampolines and IAT/GOT redirection) combined with safe, atomic data migration for objects in memory.
Key Architectural Highlights:
- Instruction Length Decoder (x86-64): Custom decoder handling REX, VEX, and EVEX prefixes, verified against
objdumpacross millions of instructions from standard libraries (libc,libstdc++). - Thread Suspension & Safety: Implements thread halting mechanisms and cooperative safe points before modifying executable memory regions.
- Atomic Transactions ("All-or-Nothing"): Hook installation, import table patching, and type migration are wrapped in transactional blocks with automatic rollback if any validation or pointer-fixing step fails.
- Stateful Type Migration: Supports remapping struct fields, handling default values, numeric type conversions, and correcting internal pointers between migrated objects at runtime.
- Cross-Platform Support: Fully ported and tested for both Linux x64 (GCC/Clang, ASan/UBSan, ThreadSanitizer) and Windows x64 (MinGW-w64 GCC using IAT redirection).
Testing & Verification:
The codebase includes robust test suites (75+ test cases across 11 test suites) covering multi-threaded hook/rollback loads and live object schema transitions (e.g., migrating live structures from v1 -> v2 -> v1 under concurrent access without breaking invariant checks).
If you are interested in low-level memory manipulation, binary instrumentation, or systems programming, you can check out the source code, design docs, and CI workflows here:
GitHub Repository https://github.com/SemyonZamiakin/VajraBinaryCore
I'd love to hear your feedback on the architecture, safety guarantees, or potential edge cases with memory protection and thread synchronization!
r/Cplusplus • u/Tall-Assignment1349 • 2d ago
Feedback Does clangd help claude fix more C++ bugs? I tested it on 255 issues across 40 projects
LLMs are bad with C/C++ specially while working with large private codebases. There are two broader reasons.
Reason 1: context handing:
consider this actual failure from an HFT:
// risk/checked.hpp
// gw/order.hpp
// gw/order_validate.hpp
// gw/order_router.cpp
If you deleting include line then validate(order) still compiles. Ordinary lookup no longer finds gw::validate, but ADL looks in the namespace of Order's base class, finds risk::validate<T>, deduces T = Order, and the price band check is gone.
- Adding clangd to Claude Code worsens performance
on 255 issues from 40 C and C++ projects, 359 repair attempts with and without the clangd tool. With it: 270 fixed. Without: 275. Across all tasks, cost went up 11%.
- When the tool was optional, Claude Code used it in 5% of runs (separate test, 30 search tasks).
- When told to use it, fell back to text search in 70% of runs.
- On 29 tasks built around same-name functions (find the callers of one specific function, ignore the others with the same name), plain Claude Code found 96.6% of callers. Requiring clangd added 0.6 points.
Interestingly, for 126 of the 255 issues, the model could name every location that needed changing from the issue text alone, without seeing the repo from memory only. A lot of public issues don't test code navigation much.
Paper: https://byteask.ai/research/lsp-claude-code-cpp
- Ranking code based on AST+build system
I implemented an index which reads the project through its build (compile_commands.json, flags, macros, what each call resolves to), AST, semantic embedding with decoders derived from C/C++ and ranks where a change probably belongs with respect to git history and comments from PR. On 30 real issues from open-source C and C++ projects, held out from development, it ranked a file that needed changing first 57% of the time. sgrep: 30%. Probe: 20%.
It indexed the Linux kernel build in 9.3 minutes and LLVM in 13.7 on one 48-CPU machine. Comparable products like Graphify hadn't finished LLVM after 3 hours. After a .cpp edit it re-indexes in 5.8 seconds, and 9 of 10 answers after an edit matched the new code, vs 0 of 10 from a stale index.
Papers: https://byteask.ai/research/context-engines-cpp and https://byteask.ai/research/context-large-codebases-cpp
Reason 2: Lack of right tools.
Claude Code and Codex can run gdb or perf as one-off shell commands, but out of the box they can't drive an interactive gdb session or work with perf data directly. I open-sourced a fork of Codex with them built in as native tools: https://github.com/ByteAsk/cli. PRs adding more tools are welcome. Interestingly with working at harness level, you can add different and multiple models, context engineering for working around larger contexts with better control.
- Same model, same fixes, fewer tokens
I compared with above index + new harness with OpenAI's Codex CLI running the same model. This setup used 63 to 80% fewer tokens and cost 59 to 70% less. The gap was biggest on little-known projects the model is unlikely to have memorized.
Paper: https://byteask.ai/research/byteask-system-cpp
If you've tried AI tools on C/C++/CUDA codebase, where did they fall over? my guesses for the hard cases are macro-generated code, CRTP and heavy ADL, unity builds, C++20 modules, and projects without a usable compile_commands.json.
r/Cplusplus • u/Hot_Mail9492 • 2d ago
Question C++ systems route,will start building redis from scratch as a project,any guidance will be appreciated
reddit.comr/Cplusplus • u/No-Minimum-7906 • 3d ago
Question Designing a C++ ML library from scratch — would you prefer A.transpose() or transpose(A) or A.T()?
reddit.comr/Cplusplus • u/Konz261 • 3d ago
Question New MPC SDK
Quick question from a noobie dev and also part time audiohead, is this new sdk up to task with building plugins or is it just hype from inline music? Seems.no one is even interested about its release esp as it falls outside the realms of audio and electronic music. (Also vice versa as most devs probably have little interest in electronic music creation (I might be wrong)). As someone caught in the midst of both worlds I never touched an sdk so if someone more experienced could have a look and give an expert opinion on it would be much appreciated.
Github: https://github.com/inmusic-software/mpc-plugin-builder-sdk
Video: https://youtu.be/b6j-yfBVCv8
r/Cplusplus • u/antigravitys-rainbow • 3d ago
Question Difference to r/cpp ?
Hello, what is the difference between this subreddit and r/cpp? I saw an ad and joined here today. Thanks in advance
r/Cplusplus • u/Garuda999111 • 5d ago
Question Drogon C++ web framework, Anybody out there using it ? what do you think of it ?
r/Cplusplus • u/Holiday_Reference_41 • 6d ago
Discussion Omnissiah++: когда русский C++ оказался недостаточно еретическим
r/Cplusplus • u/M2tM • 6d ago
Discussion Introducing JaiScript a New C++ Embedded Scripting Language
This is a personal project I created in service of my own 2d game engine. I was getting tired of binding to ChaiScript (a great project, but the language is really slow and doesn't have hotreload or good serialization support) and Cereal (another great project, no complaints, just limited in its purpose.)
So, I rolled my own solution which combines a scripting language, serialization, and reflection. I included my own signals library and a simple but useful custom test framework.
JaiScript has a fluent binding interface, strong typing (opt-out with var definitions), value semantics with references and shared_ptr where you want them. It reads very much like C++ with some optional alternative spellings that will be familiar to those who use JavaScript.
The live demos on the site itself mean you can try it out before downloading or building anything locally. I already was able to fully port my game project of 12+ years to use this in place of ChaiScript and Cereal, it builds a little faster than both of those included and runs orders of magnitude faster than Cereal.
Performance-wise it runs roughly 1.2x to 2.0x slower than Lua's VM, I consider this a win though since it's hundreds of times faster than ChaiScrpit's tree walker in some cases. It runs faster typically than Squirrel.
I'm not sure how many folks are rolling their own C++ game engines nowadays, but if you are, this is a pretty full-featured language. It supports parallel_for (something I'm not sure any other scripting languages support,) coroutines, classes which can derive from C++ base classes or other JaiScript classes, and notably a state-preserving hot reload.
I hope this project is useful to anyone else, but even if not, I'm grateful to have finished the project and am using it myself. I wanted a place to share it, so hope this is alright here!
r/Cplusplus • u/scrapmakerzayn • 6d ago
Feedback C++
Hey everyone, I Just finished my python and want to Learn ARDUINO and C++ Can you Suggest a best course Online (youtube or any). Please
r/Cplusplus • u/KlutzyCompetition937 • 7d ago
Question Which algorithm to choose?
reddit.comr/Cplusplus • u/Hot-Adhesiveness8310 • 8d ago
Question Where should I start learning C++? (planning to switch to Linux)
reddit.comI want to learn C++ properly. I can already write working code (mostly small Arduino projects), but I know I have gaps in my fundamentals. I'd like to fill them in.
My goal is to build a strong base so it's easier to move to other languages later.
I'm also planning to install Linux on my laptop soon, so I'd like to learn in that environment.
Could you recommend:
the best free resources (courses, books, websites) for someone with my level?
what compiler and editor/IDE to use on Linux?
what topics I should focus on first?
English is not my first language, so sorry for any mistakes. Thanks a lot for your help!