r/Cplusplus • • 10h ago

Feedback Finally built something in C++ I’m super proud of! (Goodbye, basic calculator 👋) 🎯

Post image
90 Upvotes

Hey everyone!

​I'm a beginner at C++, and up until now, the only thing I had made was the classic basic calculator that everyone builds when starting out. 😅

​I wanted to step it up a bit and built a Number Guessing Game, and it turned out so much fun! It's the first project I've made that I'm genuinely proud of, so I wanted to show off what it looks like in the terminal 🌸🤭ik it's pretty basic for all u pros but i've started just a week ago..ig that counts for smthing 😋🥲(PS:Open for all constructive feedbacks😌)


r/Cplusplus • • 1d ago

Feedback CxxDox, a mkdocs plugin for complex C++ projects [Github/Apache2.0]

Thumbnail
github.com
1 Upvotes

r/Cplusplus • • 1d ago

Homework blackhole simulation using openGL and c++

0 Upvotes

i made a simulation of the blackhole gargantua that is also seen in intersteller
It's written in C++ and openGL

i managed to optimize it to a point i ran on my i3 intel iGPU, although i added very low to high quality toggles, it's my first time writing in glsl so yeah, i was a lot inspired by the yt video of Kavan about making a blackhole in cpp, so i just wanted to make it more realistic, my astrophysics lectures kinda came in clutch

github repository : https://github.com/dummy3ye/blackholegl (star the repo if you like it)


r/Cplusplus • • 3d ago

Discussion What’s a C++ memory bug your tests missed? Manning’s Memory Safe C++ MEAP + 5 ebook giveaway

Thumbnail
gallery
51 Upvotes

Hi r/cplusplus!

Stjepan from Manning here. The mods have given us permission to share Memory Safe C++: How to Write Safety-Critical Software by Jean Frantz René, now in Manning’s Early Access Program (MEAP).

Code compiles cleanly, passes the tests, and gets through a general-purpose lint check. How much confidence should that actually give you about memory safety?

That’s the starting point for the book’s case studies. You investigate apparently healthy C++ code, find the hidden defect, trace what happens at the machine level, and work through competing fixes.

The useful part is getting beyond “here’s the corrected code.” Each case study compares working solutions on memory use, determinism, compliance, and remaining risk. The goal is to help you recognize similar defects in your own code and explain why a particular fix fits your constraints.

For anyone curious about the lower-level details, that includes examining stack frames, how function prologues change between optimization levels, and what a sanitizer’s shadow state records. There’s a companion repository so you can run the examples yourself.

The book is aimed at readers who already know C++ and want to move toward safety-critical work. It also connects implementation decisions to MISRA C++:2023 and the requirements of industries where a failure can cause physical harm.

It’s still being written: MEAP gives you access to chapters as they become available, plus the finished ebook when it’s ready.

https://www.manning.com/books/memory-safe-c-plus-plus

GIVEAWAY:

We’re giving away 5 free ebook copies, one each to five commenters who contribute most thoughtfully to the discussion. We’ll choose based on the substance of the contribution, not upvotes or whether you say something positive about the book. A useful question, a well-explained disagreement, or an experience others can learn from all count. No purchase necessary.

For everyone else, Manning is also providing the community 50% off the book with code MLRENE50RE at checkout.

To get the discussion going: what’s a C++ memory-safety bug that slipped past your tests or code review? What finally exposed it—and did the fix introduce any trade-offs you hadn’t expected?

If you’re still learning, what part of memory safety do you find hardest to reason about? Thoughtful questions are welcome too.

Thank you for having us here.

Cheers,

Stjepan


r/Cplusplus • • 4d ago

Discussion How it feels learning a new language.

Thumbnail
gallery
101 Upvotes

Am i the only one who feels this way?

Yes, i started learning C++ and i'm comfortable with it

\For now**

I started yesterday, and i'm not having any trouble, but scared of one thing.. Pointers, people make it sounds so scary like it's gonna haunt me.


r/Cplusplus • • 3d ago

Question What is the best way to represent a graph(the structure)

2 Upvotes

What is the best way to represent a graph(the structure) where the nodes and the edges have information too, not just what they connect to

I'm looking for a representation that will be fast for propagating through the graph from one node to the end of the subgraph, so I should have very low cache misses

If anyone has worked on something similar already, please save me time and share the structure you used

Edit: To clarify the use case: I’m building a reactive evaluation graph. When a node's data changes, that change propagates downstream through connected edges, using edge metadata to compute transformations, until reaching the end of the subgraph. I need a memory layout that minimizes cache misses during these forward cascade passes.


r/Cplusplus • • 5d ago

Question What graphics library should I learn for C++?

41 Upvotes

I am currently learning C++ by myself and I want to start graphics.

I just need something simple that lets me have buttons.

btw I don't want to use VS Community Edition and my IDE is CLion

I mean a simple GUI library with 2D graphics, buttons and textboxes.


r/Cplusplus • • 5d ago

Question Pseudo code and bubble sort C++

6 Upvotes

Hey guys, I'm in year 2 of college and I have a test tomorrow about pseudo code and bubble sort and i am veeerrryyy lost, literally have no idea what's going on. Are there any good youtube videos you guys can recommend me? Or give me a short and brief understand of what's it about? Thank you very much in advance.


r/Cplusplus • • 5d ago

Question Looking for C++ textbook that is friendly like Stewart Calculus for math

Thumbnail
2 Upvotes

r/Cplusplus • • 6d ago

Question How can I build low-latency/high-performance systems

18 Upvotes

For people who have worked on low-latency/high-performance systems, what are the biggest differences between writing normal production code and writing genuinely latency-sensitive code?

I understand things like cache locality, data structures, algorithmic complexity, branch prediction, and avoiding unnecessary allocations, but I have a feeling there is much more to it.

I'm particularly interested in single-machine systems rather than distributed systems. What techniques or considerations have you found to matter most in practice?

Also, what would you recommend someone learn to develop a good intuition for this? Books, papers, tools, or projects are all welcome.


r/Cplusplus • • 6d ago

News [Open Source] slick-logger v2.3.0 — Lock-free asynchronous C++20 logging with customizable timestamps

0 Upvotes

Hi everyone,

I've just released slick-logger v2.3.0, an open-source, header-only C++20 logging library focused on low-latency and multithreaded applications.

The new release introduces customizable timestamps, allowing applications to use their own clock sources, including calibrated TSC clocks, simulated time for backtesting, and fixed clocks for deterministic testing.

Other features include:

  • Lock-free MPMC queue with asynchronous logging and deferred formatting
  • Multi-process logging using shared memory
  • Multiple sinks, log rotation, and customizable formatting
  • Source-location tracking and runtime statistics
  • Cross-platform support for Windows, Linux, and macOS
  • Available through vcpkg

I've also published benchmarks comparing slick-logger with spdlog, including producer-side throughput and latency measurements.

The project is MIT-licensed, and contributions and feedback are welcome.

GitHub: https://github.com/SlickQuant/slick-logger

Release notes: https://github.com/SlickQuant/slick-logger/releases/tag/v2.3.0

I'd particularly appreciate feedback on the custom timestamper API and the concurrency architecture.


r/Cplusplus • • 7d ago

Discussion What is the most difficult error you've ever had to solve in c++?

33 Upvotes

Errors can be very frustrating in C++, especially when they are tricky to solve. What is the most difficult one you've ever had to figure out how to deal with?


r/Cplusplus • • 7d ago

Question Data Structures in C++

Thumbnail
0 Upvotes

r/Cplusplus • • 7d ago

Tutorial Working with BLE Devices with C++ and Boost Using the BleuIO

Thumbnail bleuio.com
2 Upvotes

In this tutorial, we will create a simple command-line BLE scanning application using C++. The program connects to the BleuIO USB dongle through a serial port and sends AT commands to control Bluetooth operations. After starting the program, the user enters the number of seconds to scan, and the application instructs the BleuIO dongle to perform a BLE scan and print the detected devices directly in the terminal. This example demonstrates the basic workflow of communicating with BleuIO from a C++ application.

Details and source code available.


r/Cplusplus • • 8d ago

Question Getting better at C++ for coding interviews?

Thumbnail
1 Upvotes

r/Cplusplus • • 9d ago

Question Just started learning C++

Thumbnail
7 Upvotes

Hello, I started learning C++ today. I'm a guy who doesn't want to rely on AI for coding and who really needed another language alongside mr. Nasty Py (cybersecurity), but I'm SUPER lost.

Can anyone give me some tips? I've been coding since I was 11 (I'm 14 now). I'd really appreciate any advice!

One of the reasons I'm learning C++ is so I can say: "I code in Cpp btw" like Arch users. (JK)


r/Cplusplus • • 9d ago

Question I have trouble setting up my IDE

0 Upvotes

I installed VS Code and the g++ code and the g++ compiler, and I also created a path variable for my compiler in Windows; however, when I type g++ --version in the bash terminal of VS Code, it shows "command not found." Can you tell me what might be the problem?


r/Cplusplus • • 9d ago

News A C++ Trick Question - Blog Post

Thumbnail greenlightning.eu
0 Upvotes

r/Cplusplus • • 11d ago

Feedback Constexpr Doom

Post image
26 Upvotes

I recently created a wasm interpreter in cpp to run doom at compile time, it consumed around 400gb of ram and ran at whooping 50fph(frames/hr)

https://github.com/Talkative-Banana/Constexpr-Doom


r/Cplusplus • • 11d ago

Question Book recommendations for C++ beginner

16 Upvotes

Hi all, I recently decided to join an informatics olympiad in my country, and I was wondering if there are any good, MODERN, C++ 20 books out there? I've finished Python Crash Course, so I have some programming experience. I find books like Guide to Competitive Programming too straightforward (jumping into namespaces and importing entire standard library and expecting us to know what a gcc compiler is). Please recommend some good books, thank you


r/Cplusplus • • 11d ago

Answered Working on my own 3D engine — Gri Engine. First steps: rendering, scene view, and an inspector.

Post image
3 Upvotes

Slowly building my own engine called Gri Engine. It's a personal project — I'm making it for myself and my own games/animations, not planning to compete with Unity or Unreal.

Right now it can render a scene with a movable cube, has a basic editor UI with an inspector panel, and shows FPS/performance stats. The transform and material properties are editable in real time.

Still very early, but I'm learning a lot. Just wanted to share the progress.

(OpenGL, C++)


r/Cplusplus • • 11d ago

Question Is writting books means giving them for free, now

3 Upvotes

Bjarne and Herb wrote C++ Core Guidelines on github. (https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) It's a 350 pages equivalent book.

It's totally free as a markdwon file.

if legends from C++ give it for free, do you think each book author should give their own books for free. As a book author, I have giving some of my books to recruitments companies or for having contracts but it's so easy to understand nobody still buy books that freedom for everything should be the next era ?

I ask myself because it take me 4 or 6 months to write a book. On Amazon, my professional C++ philosophy and principles is my 30 years of the field and I am prou to have written my life in a book for my daughters and let them a trace from my own little existence in the IT industry.

But the reality is that it costs a lot to write abook. It does not pay. My last french editor in France called DUNOD gave me 10% on two books "Cookbook C#" and "Cookbook C++" -> they sold it at 23 EUR for each book and I earn so only 2 EUR per books. Printing was 2 times 1.500 items. A shame. It toolks me a year to write these two books.

So the problem is that C++ is no more teached in university (a shame), no more books writer sor so many... Writing books means 'pedagogie', the love of teaching and explaining complex stuff in easy way of understanding.

Is the future to write .md files on github or self AKDP (Amazon Kindle Publishing) like I do.

What is the future of writing books. It's a personal reflection. This is the end of an era. I grew up with Bjarne books and red book from Addison Welsey. I ripped thousands of chm and pdf files among 30 years. Looking at kids no buyuing books, i'm a dinosaur. I would like to give thme my 500 GB folders of books.

Reading books and writing books is two different piece of thinking and self meditation. reading is a the learning experience that make you feel confident. Writing book sis the achievement you are confident to give back to the community what they gave to you. Nobody invent. Not use. legends invent. I am not. So I have learned,; practices, failed (90% of the time) an success is happening just because of time spent on training. It's like sport at a professionnal level.

Whar are you thoughts about books, reading of buying.

Chris


r/Cplusplus • • 11d ago

Feedback [Release] slick-logger v2.2.0 — Lock-free asynchronous C++20 logging with multi-process shared-memory support

Thumbnail
0 Upvotes

r/Cplusplus • • 11d ago

Question Any suggestions for making a physics simulation model?

Thumbnail
2 Upvotes

r/Cplusplus • • 11d ago

Question Tell me what the best tools to learn C++

Thumbnail
0 Upvotes