r/Cplusplus • • 23d ago

Subscriber Goal Welcome to r/​Cplusplus!

0 Upvotes

Welcome to r/Cplusplus

62680 subscribers / 75k subscribers. Help us reach our goal!

Open this post in the Reddit app or on reddit.com to join.


r/Cplusplus • • 7h ago

News InsideC++26491, The Module Story

Thumbnail
youtu.be
3 Upvotes

With CMake's support for import std no longer experimental, we thought it was a good time to talk about modules.
Gabriel Dos Reis joins us at InsideC++ to discuss the original design goals, the history of standardization, the compromises, the tooling challenges, and what comes next.


r/Cplusplus • • 21h ago

Tutorial ភាសា​ C++ Part4: 6 String Exercises .

Thumbnail
youtube.com
1 Upvotes

r/Cplusplus • • 2d ago

News Wolaz: Protobuf in non-dynamic-allocating C++

Thumbnail
github.com
2 Upvotes

Protobuf is the most popular serialization format, but it has always been difficult to use Protobuf in in embedded systems because all of the conforming C++ Protobuf implementations require dynamic memory allocation.

Wolaz is the first mostly-conforming C++ Protobuf implementation which uses only stack memory. It works by the "lazy view" technique on the I/O buffer, also known as "zero-copy."


r/Cplusplus • • 1d ago

Discussion Thoughts on safe-c

Thumbnail
reddit.com
0 Upvotes

r/Cplusplus • • 2d ago

Question How can I learn cpp properly (I more likely want books)

Thumbnail reddit.com
0 Upvotes

hey guys, i'm pretty new to c++ and honestly i cant find good resources. how can i learn c++ and more importantly i dont have much access to a pc right now. so is it worth buying a book for c++? if i buy one is there a good book that will take me from the start all the way through? id appreciate any info. like a book that explains the basics and everything, ideally simple english, if not simple english thats fine too. also if there happens to be a turkish translation that would be really nice, if not its whatever. thanks


r/Cplusplus • • 2d ago

News How to Generate C++ Docs Straight from Clang with MrDocs

Thumbnail
youtube.com
10 Upvotes

A new C++ documentation tool, presented in a very creative way by combining a CppCon talk with some documentation B-roll.


r/Cplusplus • • 3d ago

Discussion I don’t even hate AI, I just feel a little sad about being obsolete

Thumbnail reddit.com
7 Upvotes

r/Cplusplus • • 3d ago

Feedback HimitsuObfuscator: Whitelist-driven C/C++ obfuscator with LLVM 17

Thumbnail
github.com
7 Upvotes

r/Cplusplus • • 3d ago

Question How can i start c language

Thumbnail reddit.com
0 Upvotes

r/Cplusplus • • 3d ago

Tutorial Less Code Doesn't Mean Faster Code

Thumbnail
reddit.com
1 Upvotes

r/Cplusplus • • 3d ago

Question where am I heading?

Thumbnail reddit.com
1 Upvotes

r/Cplusplus • • 5d ago

Question Specific features you look for in a logger

Thumbnail reddit.com
0 Upvotes

r/Cplusplus • • 5d ago

Answered Kod na Infe op3

0 Upvotes

#include <iostream>
using namespace std;

int main() {
char op;
double a, b, wynik;

cout << "Podaj operacje (+, -, *, /): ";
cin >> op;

cout << "Podaj pierwsza liczbe: ";
cin >> a;

cout << "Podaj druga liczbe: ";
cin >> b;

if (op == '+') {
wynik = a + b;
cout << "Wynik: " << wynik;
}
else if (op == '-') {
wynik = a - b;
cout << "Wynik: " << wynik;
}
else if (op == '*') {
wynik = a * b;
cout << "Wynik: " << wynik;
}
else if (op == '/') {
if (b != 0) {
wynik = a / b;
cout << "Wynik: " << wynik;
}
else {
cout << "Nie mozna dzielic przez zero!";
}
}
else {
cout << "Nieznana operacja!";
}

return 0;
}


r/Cplusplus • • 6d ago

Discussion 29M | IST | Study partner for the book C++ Concurrency in Action

Thumbnail reddit.com
0 Upvotes

r/Cplusplus • • 6d ago

Feedback cortex (`cx) - A Cargo/uv-inspired package manager and build tool for C and C++

Post image
1 Upvotes

Hello!

I’ve been working on cortex (cx), a C/C++ package manager and build tool inspired by Rust’s Cargo and Python’s uv, and I’d love to share it with you and get some feedback.

Why another tool?

Setting up a C++ project with clean dependency management, lockfiles, features, and workspaces often requires gluing together multiple tools and boilerplate CMakeLists.txt files. With cx, you describe your package in a single cx.toml file, it resolves and locks dependencies, generates the underlying CMake project, and drives the build automatically.

Quick example

cx new hello
cd hello
cx add nlohmann\\_json --git https://github.com --tag v3.12.0
cx run

Key Features

Zero-boilerplate builds: Sources, tests, benchmarks, and examples are discovered by convention (src, tests, benches, examples). Supports mixed C (C90–C23) and C++ (C++98–C++26), including C++20 modules (.cppm, .ixx).

Flexible dependency management: Pull dependencies from registries, Git repos, local paths, system packages (\mfind_package), or vcpkg. Any existing CMake, Autotools, or SCons project works out of the box as a Git or path dependency.

PubGrub version resolution & lockfiles: Uses the PubGrub solver (like uv and pub) for clear conflict explanations, and pins exact versions, Git commits, and SHA-256 hashes in cx.lock.

Cargo-style features & workspaces: Supports optional dependencies, feature flags (exposed via CX_FEATURE_ macros), and multi-package workspaces sharing a single lockfile and target/ directory.

Built-in developer workflows: Comes with cx test, cx bench, cx fmt (clang-format), cx lint (clang-tidy), cx doc (Doxygen), cx vendor for offline builds, and built-in sanitizer/LTO build profiles.

IDE & CI friendly: Generates standard CMake projects (cx generate) and JSON metadata (cx metadata) so your existing IDE setup works seamlessly, plus --locked and --offline flags for CI.

Current Status & Caveats

First Release & Self-Hosting: This is the very first release. Right now the repo still includes its bootstrapping CMake files, which will be removed in the next release now that cx can build itself.

OS Support: Works on Linux and macOS. Windows (MSVC) support is newly added and passing in CI, though it hasn't been battle-tested in the wild yet.

Public Registry: There isn't a central public registry yet, though cx works directly with Git repositories, local paths, vcpkg, system packages, and includes a lightweight self-hosted registry server (cx-registry).

Links

GitHub Repository

The cx Book (Documentation)

You can install prebuilt binaries via the install script in the README or build it from source with CMake 3.28+ and a C++23 compiler. 

I’d really appreciate any feedback, bug reports, or thoughts on what would make this genuinely useful for your C/C++ workflows! Notice: the code made use of AI for cross-platform support, to get some features implemented quickly and fix some bugs.

Thanks


r/Cplusplus • • 7d ago

Question What is the best way to build a physics engine from scratch?

Thumbnail reddit.com
0 Upvotes

r/Cplusplus • • 8d ago

Question Best book for learning C++ as an beginner?

37 Upvotes

Hello everyone! As the title says, what book for learning C++ would you recommend? Specifically modern C++ 23, but also the general basics.


r/Cplusplus • • 8d ago

Discussion hi, i started learning cpp by myself since about 2 weeks ago, and i wrote my first useful simple program. the thing is that cause i learn by myself i don't know where my level is, so i wrote this program as a hope someone can judge me based on the simple first program i wrote.

Thumbnail reddit.com
0 Upvotes

r/Cplusplus • • 9d ago

Question Where does the Curiously Recurring Template Pattern actually earn its keep in production code

Thumbnail reddit.com
2 Upvotes

r/Cplusplus • • 9d ago

Question I began coding with C++, should I continue learning it or should I drop it and start something else?

0 Upvotes

I have always wanted to learn coding and make games, but I didn't know what to do and how to start. About 4 years ago, I saw Sololearn's ad on Youtube (I'm not advertising them). Desparate to learn, I installed it. First, it asked me a few questions regarding why I want to learn coding, what I'm going to use it for (web designing, game development, ...), etc. After answering them, I got suggested learning C++, so I did. I finished the introduction course and learned about half of the intermediate course (if I remember correctly, the last thing I learned was separate files for classes).

Recently, I found out via social media that C++ is the worst language to learn as your first language. I am pretty comfortable with the syntax, but I do sometimes forget complex things like pointers, constructors and deconstructors, etc, because I don't have the time to code often. I have made a lot of small projects, and I'm currently working on a terminal version of Minesweeper that outputs the game board in colored text and is played via inputting the X and Y coordinates of the tile that you want to open or flag (I don't know how to make buttons, or programs with separate windows in general.)

I wanted to know if I should continue learning this language or should I drop it and learn something else, like Python?

Also, I have recently started working with Git, and I find it pretty complicated and hard to use. It would be nice if someone told me whether I should continue learning and using it or if it is too early and I should finish learning the language first.

(P.S.: Many apologies for my imperfect English; I'm not so good at writing and speaking, as it isn't my native language.)