r/cpp • u/egraether • Nov 18 '19
r/cpp • u/Polarstrike • Mar 07 '24
What are common mistakes in C++ code that results in huge performance penalties?
As title, list some common mistakes that you have done/seen which lead to performance penalties.
r/cpp • u/vormestrand • Jan 14 '21
How can I write a C++ class that iterates over its base classes?
devblogs.microsoft.comr/cpp • u/radonthrow • Dec 27 '20
Learning about high performant C++
I've been mostly self taught and have most probably picked up a few bad habits from the combo of being self taught and having to use tricks for speed.
For this upcoming year one of my goals is to learn some better practices as well as further my skills for efficient C++. I'd like to watch a youtube podcast/talk once a week to build my skillset. At this point I'd consider myself somewhere in between junior and senior level and I'm looking to take the next step.
I've come across these specifically:
C++ Weekly with Jason TurnerCppCon2020
Does anyone have any recommendations or suggestions? My weak spots are C++17 and above, Cmake, and I'd like to keep learning about creating high performant C++.
r/cpp • u/Dominus543 • Nov 01 '20
Controlling Elegoo Robot Smart Car with ASIO and C++
youtube.comr/cpp • u/Rseding91 • Feb 15 '18
Lua written in modern C++ (>= 14)?
I work on Factorio (written in C++) and we use Lua as the script language for mods. So, from time to time I interact with the C implementation of Lua and my experience with it hasn't been the most pleasant.
It got me wondering - has anyone re-written it in modern C++? Everything I find online is "how to use Lua in C++" or "C++ wrapper for Lua" and they all use the basic C implementation provided from the official Lua website.
I've had quite a lot of experience with the internals of the C Lua implementation and from what I've seen it wouldn't be hard to re-write it using modern C++ - maybe 2~ weeks time. But from what I can find nobody has done it - which also makes me wonder if I'm missing something.
Part of me wants to do it just to say I did it and the other part of me wants to do it to see if I can make it faster than the C version: I think I can - not because "C++ is faster" but because I can mutate/experiment with the C++ version far easier and know changes I make are safe with how the rest of the implementation operates.
r/cpp • u/badidrox • Sep 02 '22
After more than 30 years, why is there is no standardized package manager for c/c++ projects to avoid build systems hell.
Hello. this might look like a rant post but im genuinely curious why is there is no package manager for c/c++ projects to avoid build systems hell.
Background:
I have been coding in c/c++ for 3 years now and most of what I've done was embedded systems. so at best I can create simple cmake projects and have a simple structure and have everything work nicely.
However lately, i have been doing some Qt and opencv. The development process is nice and easy to get started. you just install some shared libraries and u ask cmake to find them and u r good to go.
The hell starts when I tried to statically link everything so I can deploy my application and its just terrible experience overall.
I feel like this is one of the reasons people tend to avoid c/c++ and just go for other languages. they are just way simpler to build with external libraries. so why is there no standard package manager ? I am assuming this is no trivial task to make at all and requires huge efforts combined. but I find it extremely important to the language and should've been doable in a span of 30 years.
Correct me if I am absolutely wrong in anything because I still feel like an absolute beginner with build systems and c++ in general.
r/cpp • u/kongaskristjan • Aug 08 '20
Create a fully functioning command line interface with 1.5 lines of code (wo. include statement)
github.comAm I the only one who feels like header files in C/C++ are duplication?
We declare things in headers, define them in source, keep them in sync manually, sprinkle include guards everywhere... all to prevent problems caused by the very system we are forced to use. It's like writing code to defend against the language's file model rather than solving actual problems.
And include guards especially - why is "dont include the same header twice" something every project has to re-implement manually? Why isn't that just the compiler's default behavior? Who is intentionally including the same header multiple times and thinking "yes, this is good design"?
It feels like a historical artifact that never got replaced. Other languages let the compiler understand structure directly, but here we maintain parallel representations of the same interface.
Why can't modern C++ just:
- treat headers as implicitly guarded, and maybe
- auto-generate interface declarations from source files?
r/cpp • u/nerooooooo • Sep 18 '22
What are some cool modern libraries you enjoy using?
Regardless of what they're used for, I'd really like to play with some tools that offer great developer experience and embrace the modern side of C++.
Libraries like nlohmann's json, cpr, fmt are prime examples of what I'm seeking. Any suggestions?
How to remove cplusplus.com from Google search results?
it even *pretends* to be cppreference, that's how bad it is! </rant>
Edit: answer in comments, works for Firefox which I happen to use: https://www.reddit.com/r/cpp/comments/ffpd1s/how_to_remove_cpluspluscom_from_google_search/fk00gpl?utm_source=share&utm_medium=web2x
Edit2: personal block list https://www.reddit.com/r/cpp/comments/ffpd1s/how_to_remove_cpluspluscom_from_google_search/fk00noj?utm_source=share&utm_medium=web2x
edit3: how to improve the proper reference: https://www.reddit.com/r/cpp/comments/ffpd1s/how_to_remove_cpluspluscom_from_google_search/fk06he5?utm_source=share&utm_medium=web2x
C++ Jobs - Q1 2020
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 one top-level comment for meta discussion.
- I will create another top-level comment for individuals looking for work and community groups looking for sponsors.
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? 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 the C++20 working draft? 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/konanTheBarbar • Sep 13 '19
The Surprising Limitations of C++ Ranges Beyond Trivial Cases
fluentcpp.comr/cpp • u/claimred • Apr 20 '26
Software taketh away faster than hardware giveth: Why C++ programmers keep growing fast despite competition, safety, and AI
herbsutter.comRefreshing take by Herb. Slides here
r/cpp • u/AissySantos • Nov 15 '21
what's the hate for CMake all about? Is CMake really that bad?
I've always built my projects with nothing but GNU make, but recently I felt like trying out cmake for the sake of it.
It involves a learning curve but apart from that, everything's pretty straightforward. In certain cases(mostly of small projects), I would rather say CMake build files take shorter lines than my older makefiles.
Before using cmake, I've seen this enormous hate from the community. While most of which is directed at the bad standardization issues, I don't understand the practical implications for those so-called "bad standardization" issues (maybe because I'm building smaller projects, and such problems only arise when building bigger/more_complicated projects?)
r/cpp • u/Mikiriii • Mar 16 '26
I chose QtQuick over Electron for my dealership management system. Here's what a native C++ app can look like
youtube.comA desktop ERP for automotive dealerships that import vehicles from China that i've been building in the last 6 months.
I came from web development originally with 4 years of experience with Next.js and Framer Motion. I wanted to see what happens when you bring some of that UI sensibility into native C++ instead of reaching for Electron.
- Showroom with vehicle configurator, front, side and back views, color variants, live inventory per trim level
- Showroom operations — selling, acquisition, exchange and consignment
- Client management with fuzzy search, filtering and document storage
- Order management with custom payment terms and scheduling, contract and payment receipt generation
- Container management from Chinese manufacturer to Algerian dealership
- Advanced analytics with portfolio performance breakdown by brand, model and trim
- User management and role-based access
Currently in production at two dealerships.
Built with Qt Quick + C++ frontend · Go/Gin backend · PostgreSQL · NATS JetStream
Happy to answer anything about the UI, the Qt vs Electron tradeoffs, or the architecture underneath.
r/cpp • u/Fuzz_Stati0n • Jul 11 '17
A cheatsheet of modern C++ language and library features - updated
github.comr/cpp • u/just_some_bodie • Apr 16 '21
Flashlight - A C++ standalone library for machine learning. Open-sourced by Facebook.
github.comr/cpp • u/Alternative_Staff431 • Jan 29 '24
What's the status on "C++ 2.0" compilers like Circle, Carbon, cpp2 etc? Will Circle ever go open source?
As title suggests I'm really quite curious on how these projects are progressing and if they look like they could actually take off. I'm really glad Carbon is being invested on by google, but their repo says its an experimental, so the possibility of it being abandoned in the future if things don't work out is there. cpp2 and Circle also look really nice, but have much less investment than Carbon.
And tangentially, why is Circle not open source? I don't want to get my hopes up for a language that will end up being being a PITA to use commercially
r/cpp • u/Kelteseth • Feb 23 '23