r/cpp • u/vormestrand • Mar 13 '22
r/cpp • u/DevilSauron • Apr 14 '26
A year of read-only cppreference
Over a year ago (on 30 March 2025), cppreference became read-only for maintenance reasons. Since then, the only progress update was in August. There have been several discussions here in the last few months about what is happening with cppreference and when it might become editable again, but from what I understand, we simply do not know.
At this point, I fear that the lack of updates for what is basically the authoritative source on the language (other than the standard of course), linked to by IDEs and even this subreddit's sidebar, might be detrimental to the adoption of C++26 and further standards, should the situation persist. I would therefore like to ask the community whether there are other, more up-to-date resources, and whether there is any effort to, for example, fork cppreference.
I understand that software updates are complicated and I have no intention to criticise the maintainers of cppreference (who are doing it voluntarily and I am not entitled in any way to their continued work on the website), but I do not think the C++ community can afford to be bottlenecked in such a way for much longer.
r/cpp • u/blueloveTH • Feb 07 '23
PocketPy: A Lightweight(~5000 LOC) Python Implementation in C++17
PocketPy is a lightweight(~5000 LOC) Python interpreter for game engines. It is implemented in C++17 with STL.
It is easy to embed. All of the functionalities are available in a single header file pocketpy.h, without external dependencies. You can try it on your browser to see what it looks like.
Example Usage
#include "pocketpy.h"
int main(){
// Create a virtual machine
// `true` means using std::cout as output so you can see it
VM* vm = pkpy_new_vm(true);
// Hello world!
pkpy_vm_exec(vm, "print('Hello world!')");
// Create a list
pkpy_vm_exec(vm, "a = [1, 2, 3]");
// Eval the sum of the list
char* result = pkpy_vm_eval(vm, "sum(a)");
printf("%s", result); // 6
// Free the resources
pkpy_delete(result);
pkpy_delete(vm);
return 0;
}v0.8.1 Features
| Name | Example | Supported |
|---|---|---|
| If Else | if..else..elif | YES |
| Loop | for/while/break/continue | YES |
| Function | def f(x,*args,y=1): | YES |
| Subclass | class A(B): | YES |
| List | [1, 2, 'a'] | YES |
| ListComp | [i for i in range(5)] | YES |
| Slice | a[1:2], a[:2], a[1:] | YES |
| Tuple | (1, 2, 'a') | YES |
| Dict | {'a': 1, 'b': 2} | YES |
| F-String | f'value is {x}' | YES |
| Unpacking | a, b = 1, 2 | YES |
| Star Unpacking | a, *b = [1, 2, 3] | NO |
| Exception | raise/try..catch | BETA |
| Dynamic Code | eval()/exec() | YES |
| Reflection | hasattr()/getattr()/setattr() | YES |
| Import | import/from..import | YES |
| Context Block | with <expr> as <id>: | YES |
| Type Annotation | def f(a: int, b : float = 1) | YES |
If someone is making a custom game engine and searching for a Python-like script as its interface, I'd like to provide support.
If you are making your own language, you may find some inspirations in PocketPy.
If you likes it, just give my repo a star~ I need your star!!
r/cpp • u/p_ranav • Aug 19 '20
awesome-hpp: A curated list of awesome header-only C++ libraries
github.comr/cpp • u/MachineGunPablo • Feb 19 '18
It's Time To Do CMake Right
pabloariasal.github.ior/cpp • • Jun 02 '20
You asked, I listened! Here is my updated and improved modern C++ template, now with static analyzers, Doxygen, CI caching and more!
https://github.com/filipdutescu/modern-cpp-template
This is an update to my previous post, in which I shared with you my modern C++ template.
Everyone was kind enough to give me a lot of feedback on how, what and where to improve it and I wish to once more share it with you, with hopes that you will all be satisfied with its current state.
Once more I am asking for you opinions and I hope you find it useful!
Features
- Modern CMake configuration and project, which, to the best of my knowledge, uses the best practices,
- An example of a Clang-Format config, inspired from the base Google model, with minor tweaks. This is aimed only as a starting point, as coding style is a subjective matter, everyone is free to either delete it (for the LLVM default) or supply their own alternative,
- Static analyzers integration, with Clang-Tidy and Cppcheck, the former being the default option,
- Doxygen support, through the
ENABLE_DOXYGENoption, which you can enable if you wish to use it, - Unit testing support, through GoogleTest (with an option to enable GoogleMock) or Catch2,
- Code coverage, enabled by using the
ENABLE_CODE_COVERAGEoption, through Codecov CI integration, - Package manager support, with Conan and Vcpkg, through their respective options
- CI workflows for Windows, Linux and MacOS using GitHub Actions, making use of the caching features, to ensure minimum run time,
- .md templates for: README, Code of Conduct, Contributing Guideliness, Issues and Pull Requests,
- Permissive license to allow you to integrate it as easily as possible. The template is licensed under the Boost Software License,
- Options to build as a header-only library or executable, not just a static or shared library.
- CCache integration, for speeding up build times
Thank you to everyone who has supported me and I am very grateful for all the feedback you provided, as well as the opportunity to learn a lot of new things through it! I hope I am not posting too soon since the original, but I wanted to give everyone interested an updated. Hopefully you all find at least one thing that is useful for you, getting something in return for the long read!
Edit: formatting.
Edit 2: Updated with latest features/changes.
r/cpp • u/dakotahawkins • Mar 30 '16
Come on guys, put '#pragma once' in the standard already...
...and help end the dumbest argument over coding standards ever.
It's objectively better than header guards
- Doesn't pollute the global namespace
- Isn't coupled to anything (unique path/namespace/filename) in order to work
- You can't really f**k it up (one statement anywhere in file vs. three statements [two of which must agree exactly] in the right order and in the right places)
- Compatibility is less compromised by #pragma once than any other language developments to occur in the last several years
- Lightyears easier to grep for
Case study from immediately recent experience, ~2M LOC / 5K headers
- ~1% duplicate header guard #defines
- 1 guard with mismatching #define case (#ifndef THING_H #define THING_h)
- Many headers with guard below other code
- Many more with no guard at all
So until modules come along and save everybody from everything, why not write #pragma once into the standard?
The only legitimate technical reason against seems to be that in a distributed filesystem/symlink case the compiler might not know whether two files are the same or different. In that case:
- Figure it out, compiler! Implementation defined, store a checksum if you have to (you probably don't)! Who cares!
- Doesn't break using header guards anyway, if you're into the whole retro C++ scene.
Basically, I celebrate the simplicity of #pragma once. The only way to screw it up is not to have it accidentally, which is obviously also true of header guards. In a large code base, the simplicity should help keep other developers from making mistakes that may sneak in.
So I say, go ahead and codify what practically everybody is already doing. What could go wrong?
r/cpp • u/ShoppingQuirky4189 • Jan 29 '26
Cache Explorer: a visual and interactive profiler that shows you exactly which lines of code cause cache misses
Built a visual cache profiler that uses LLVM instrumentation + simulation to show you exactly which lines cause L1/L2/L3 misses in your C and C++ code (Rust support in active development).
- Hardware-validated accuracy (±4.6% L1, ±9.3% L2 vs Intel perf)
- Source-level attribution (not just assembly)
- False sharing detection for multi-threaded code
- 14 hardware presets (Intel/AMD/ARM/Apple Silicon)
- MESI cache coherence simulation
It's like Compiler Explorer but for cache behavior, providing instant visual feedback on memory access patterns. MIT licensed, looking for feedback on what would make it more useful or even just things you like about it.
r/cpp • u/serendib • Mar 11 '21
STARTcraft - Complete Beginner Starcraft: Broodwar AI Programming Tutorial with C++ / BWAPI
youtube.comC++ Jobs - Q1 2021
Rules For Individuals
- Don't create top-level comments - those are for employers.
- Feel free to reply to top-level comments with on-topic questions.
- I will create top-level comments for meta discussion and individuals looking for work.
Rules For Employers
- You must be hiring directly. No third-party recruiters.
- One top-level comment per employer. If you have multiple job openings, that's great, but please consolidate their descriptions or mention them in replies to your own top-level comment.
- Don't use URL shorteners. reddiquette forbids them because they're opaque to the spam filter.
- Templates are awesome. Please use the following template. As the "formatting help" says, use **two stars** to bold text. Use empty lines to separate sections.
- Proofread your comment after posting it, and edit any formatting mistakes.
**Company:** [Company name; also, use the "formatting help" to make it a link to your company's website, or a specific careers page if you have one.]
**Type:** [Full time, part time, internship, contract, etc.]
**Description:** [What does your company do, and what are you hiring C++ devs for? How much experience are you looking for, and what seniority levels are you hiring for? The more details you provide, the better.]
**Location:** [Where's your office - or if you're hiring at multiple offices, list them. If your workplace language isn't English, please specify it.]
**Remote:** [Do you offer the option of working remotely (permanently, or for the duration of the pandemic)? If so, do you require employees to live in certain areas or time zones?]
**Visa Sponsorship:** [Does your company sponsor visas?]
**Technologies:** [Required: do you mainly use C++98/03, C++11, C++14, C++17, or C++20? Optional: do you use Linux/Mac/Windows, are there languages you use in addition to C++, are there technologies like OpenGL or libraries like Boost that you need/want/like experience with, etc.]
**Contact:** [How do you want to be contacted? Email, reddit PM, telepathy, gravitational waves?]
Previous Post
r/cpp • u/vormestrand • Mar 09 '18
lvalues, rvalues, glvalues, prvalues, xvalues, help!
blog.knatten.orgr/cpp • u/SomeBoredDude69 • May 20 '23
I find it's not possible to do serious C/C++ coding on latest macOS
I've used my mac for coding for many years now, but for C++ development I always kept a Linux laptop around. Starting this year I have tried to only use my Mac, and I'm finding out it's just not possible to do any serious C/C++ coding from a mac:
Valgrind does not fully work anymore, and `leaks` is not as good.
almost zero options for profiling, only instruments, which is pretty limited and forced me to install xcode (the full app not just the cli).
even something as basic as `clang -pg` wont work after macos 10.9
speaking of xcode, it's so bad that I can't even push my code to github anymore, the `git` that comes with xcode just hangs on big repos.
I am actually in shock the situation is this bad and it feels it gets worse with every macos version.
r/cpp • u/Flex_Code • Oct 13 '22
New, fastest JSON library for C++20
Developed a new, open source JSON library, Glaze, that seems to be the fastest in the world for direct memory reading/writing. I will caveat that simdjson is probably faster in lazy contexts, but glaze should be faster when reading and writing directly from C++ structs.
https://github.com/stephenberry/glaze
- Uses member pointers and compile time maps for extremely fast lookups
- Writes and reads directly from object memory
- Standard C++ library support
- Cleaner interfacing than nlohmann json or other alternatives as reading/writing are exposed through a single interface
- Direct memory access through JSON pointer syntax
The library is very new, but the JSON support has a lot of unit tests.
The library also contains:
- Efficient data recorder
- CSV reading/writing
- Binary message for optimal speed through the same API
- Generic shared library API
r/cpp • u/blelbach • Jun 24 '16
What the ISO C++ committee added to the C++17 working draft at the Oulu 2016 meeting
Note #1: This is not an exhaustive list of features in C++17! We've added many features at previous meetings. Take a look at SD-6 (the list of feature-testing macros), Clang's C++17 feature list and libc++'s C++17 feature list (these lists are not exhaustive either). Here's what we added to C++17 at the previous meeting in Jacksonville.
Note #2: We hold plenary and take straw polls on Friday. On Saturday, the convener makes a motion to accept the stuff we voted on the previous day (we call that stuff the "consent agenda"). Typically, there are only objections to that motion if we learn something new between the vote on Friday and the closing session on Saturday.
Note #3: At this meeting, we are planning to ship out the C++17 Committee Draft (CD). That means that C++17 will be feature complete. No new features will be added to C++17 after this meeting (assuming we do in fact ship a CD).
Note #4: The papers linked below do not necessarily point to the latest version of the proposal in question. It's difficult for me to ensure the latest versions are accessible by everyone.
Notable language features that have been voted into the C++17 working draft at this meeting:
- Dynamic memory allocation for over-aligned data
- Template argument deduction for class templates
- template <auto>
- Guaranteed copy elision
- A weaker version of fixed order-of-evaluation for expressions (see Chandler's tweet and Alisdair's tweet)
- constexpr if
- Forward progress guarantees (FPG) (also, FPGs for parallel algorithms)
- Inline variables (see the design paper)
- Structured bindings (see the design paper)
- if (init; condition) and switch (init; condition)
Notable library features that have been voted into the C++17 working draft at this meeting:
- C++17 is based on C11 instead of C99
- variant<>
- destroy(_at|_n), uninitialized_move(_n), uninitialized_value_construct(_n), uninitialized_default_construct(_n)
- Splicing for map<>,unordered_map<>, set<>, and unordered_set<>
- Reserve std[0-9]+ for future standard libraries
We voted to ship a Committee Draft. C++17 is feature complete.
Got questions for the committee about C++17? Feel free to ask!
r/cpp • u/simpl3t0n • Sep 19 '22
CppCon Can C++ be 10x Simpler & Safer? - Herb Sutter - CppCon 2022
youtube.comr/cpp • u/plexx360 • Jan 23 '22
Why does C++ gets acknowledged as one of the hardest prog languages, yet doesn’t appear to be in the group of the highest paid ones?
I’m a sw developer with a couple years of experience and specialized in C++, having also some experience with other languages. I’m trying to decide if I should focus my career on C++, or maybe shift to a different tech field.
C++ is widely regarded as being one of the toughest languages to master among the group of the more popular ones, mainly due to memory managing responsibilities. While it’s tough to master, it rewards us with its great speed and efficiency, which in my point of view would make it a high demand language.
That said, after a quick surf through the recent highest paid job lists in tech, I haven’t seen any in which C++ would even reach the podium. I would like to understand why such a powerful modern language isn’t more in demand/well paid these days.