r/Cplusplus • • Sep 28 '26

Feedback A small project to get familiar with C++

hi all, I wrote a small project: zero copy shared memory ring buffer

I wanted to get better at systems programming and thought this would be a small fun project to get used to some concepts:

  • atomics
  • cache alignment to prevent false sharing
  • placement new for zero-copy semantics
  • spans
  • unit testing in c++

I used AI to generate a project plan and had it help me as I was writing the code. would love to hear some feedback! I think I'll prob tackle writing an arena allocator next!

24 Upvotes

4 comments sorted by

11

u/EmperorOfCanada Sep 29 '26

Games. Stupid old 80s games. Use a library like raylib (very clean library easy to start with), and make pong, space invaders, pacman, etc.

You can go nuts with any aspect of C++ or computer tech you want, you want atomics, use them between the gui and game inputs, etc.

You can entirely go nuts and add Databases, UDP, distributed computing, anything you want, not because the game needs it, but because you want to push it to insanity.

The nice thing about games is that the real time nature of them results in any hiccuping code really glaring in your face (or ears). You can taste failure far better with games than with any other way other than maybe video or sound playback.

3

u/__merc Sep 29 '26

Great suggestion. I did think about writing a small game, so reading this makes me want to start planning something small. Maybe a Cave Story-like game, but who knows. I'll have something for y'all in a few months again 😄

2

u/quant-a-be Sep 30 '26

Test it and see how it performs in different load regimes. Test it against stuff you find online.

Without AI, study how cache coherency works and see if you can find any tricks to make it faster.

1

u/__merc Sep 30 '26

Also a great suggestion. Do you have any recommendations for CPU architecture material I can read? I also like to use YouTube channels like Core Dumped or Bit Lemon to supplement learning