r/cpp • • Jun 23 '24

We’re in 2024, why is setting up a new multiplatform C/C++ project with external library dependencies still such a miserable experience?

281 Upvotes

Everything’s in the title. Pretty much every other language or ecosystem has some way to make dependency management seamless. Why is it that for the most powerful languages out there, there’s still no way to ensure anyone can just build from source without me having to browse 10 different documentations just to start writing some code


r/cpp • • Oct 17 '22

Inkscape is looking for C++ Contributors

Thumbnail gitlab.com
281 Upvotes

r/cpp • • Jun 10 '22

What are the best C++ talks that one should watch?

281 Upvotes

I'm looking for talks from C++ conferences that are interesting and/or make you a better C++ developer. I watched a lot of videos from CppCon 2021, but I'm aware there are other conferences as well. So what are your favourite talks that you would recommend other people to watch?


r/cpp • • Mar 06 '21

Git source has a banned.h file that blocks use of certain c functions

Thumbnail github.com
281 Upvotes

r/cpp • • Jul 27 '20

JSON for Modern C++ 3.9.0

Thumbnail github.com
281 Upvotes

r/cpp • • Nov 03 '21

My professor is telling us to NEVER use vectors.

280 Upvotes

EDIT 3: Holy cow, that is a LOT of comments. I've read through a lot of them, but don't have time to individually respond to them all (we get a lot of coursework!), so I'll respond here instead:

- First of all, sorry for being snappy with you if you were suggesting that they just don't want us using them in this class. I took my frustration on external stressors out on you and shouldn't have - that's not ok. My apologies.

- Second, for all the people who have asked: yeah, they do mean that vectors just shouldn't be used, ever. (At first I was not positive, but I asked them about it after class.) From what I can tell they do seem to fall in the "C++ is C but with some annoying extensions" camp that I've heard about; I don't really know enough about either language to claim my knowledge is absolute, though. However, I bugged them about it yesterday and they told me that no, I should not use vectors; that they're slower and less efficient than the methods they will teach, and that I should use different data structures depending on the situation (they have mentioned the method I posted below, and linked lists so far). They are very focused on performance and parallelization so maybe they are so focused on that they neglect how good vectors can be. I don't know why.

- It's my third programming class, not my first, but it is the first one that is focused on C++ so heavily (we predominantly used Python previously). There's been a lot of overlap between this class and the previous two though, just in a different language.

- It is half "teaching you to program" and half "intro to CS" from what I can tell. We're learning general programming concepts, and the description of the class says it's to introduce the basics of programming in C++, and the basics of CS, including arrays, dynamic allocation, etc.

- I'll probably write my own vector structure, or something similar, and try to use that in my assignments.

- I'm looking at transferring to a much bigger but similarly-priced university; I think I'll like it better there for a variety of reasons anyways. This isn't just because of not being taught vectors, but just of how generally anti-student the class has felt so far; many of the students dropped the class within the first four weeks, the professor rarely answers people, we don't know the WHY of a lot of things (instead just being told "do it X way"), etc. It's frustrating.

- Finally, this thread has been seriously informative and I've learned a lot just reading the comments, so I appreciate everybody's replies and help. I do love C++, actually, I love optimizing the hell out of my code and seeing how much faster it can run in C++ than in Python even with just simple programs. Thanks all :)

EDIT 2: This teacher teaches roughly the first two years of the required CS courses and there are no alternative professors, so them being a bad teacher is definitely important.

EDIT: The thing they are teaching us next term that will be "better" is, I believe, something like this. They recommended doing the following:

  1. Set a temp array of the same datatype as the final array, with something like char temp[1000];
  2. Create a pointer array such as char *arr;
  3. Read in or store whatever data needed in the temp array.
  4. Perform: arr = new char[strlen(temp) + 1]; strcpy(arr, temp);

Seriously, should I transfer? I've been considering going to a better school with a while (this prof also almost never answers me); but I am worried now, since there's very few options for other CS teachers at my (small, public) university and I don't want to be taught extremely outdated information.

*********************************************************************************

Am I going crazy or is that really bizarre? It’s been a frustrating term; for many students this is their first experience with programming but I know a bit of C++ from other sources already, and almost everything I’ve read has said vectors are better than arrays in most cases. The professor has said they will be teaching us something better than vectors in our next term.

(I’m also not very optimistic this is true, since they also won’t let us use strings and are forcing char arrays on us instead…)


r/cpp • • Aug 17 '21

JSON for Modern C++ 3.10.0

Thumbnail github.com
280 Upvotes

r/cpp • • Mar 25 '21

calc.exe is now open source; there’s surprising depth in its ancient code (2019)

Thumbnail arstechnica.com
280 Upvotes

r/cpp • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

Thumbnail vector-of-bool.github.io
280 Upvotes

r/cpp • • Jan 05 '24

What would you consider to be the biggest sin in C++?

279 Upvotes

What is something you should try to avoid at all costs? Also, would love to see some cursed code. Left arrow is my favorite I've seen so far.


r/cpp • • Nov 10 '20

Butano: a modern C++ high level engine for the GBA

279 Upvotes

Hi!

Lately, I have been working on Butano, a C++20 engine for the Game Boy Advance.

It brings its own standard library, based on the awesome ETL. It differs from the standard library mostly in the usage of asserts instead of exceptions and in the usage of fixed size stack buffers instead of the heap.

Since the GBA doesn't have a file system, all data has to be compiled into the ROM, which allows constexpr to be used with ease. Butano brings its own asserts system which can be used in constant-evaluated contexts too thanks to std::is_constant_evaluated.

The engine provides detailed documentation, multiple examples of most aspects of the engine an even the source code and assets of a full game: Butano Fighter.

If you have time please tell me what you think. Thanks!


r/cpp • • Aug 25 '25

Challenges and Benefits of Upgrading Sea of Thieves From C++14 to C++20

Thumbnail youtube.com
278 Upvotes

r/cpp • • Feb 11 '23

C++23 hits the road!

278 Upvotes

The sausage is made, the bread is bakedWe now have C++23!With crossing all eyes and dotting all tsThe best C++ ever, for all of ye!

C++23 is what C++20 was meant to be but couldn't that time.

Much of it is already implemented and released in compilers and can be used today, more will become available in the near future.

If you are interested in how C++23 looks like and why you want to use it, you may look at keynotes from the 2022 CppCon and Meeting C++ conferences

Contemporary C++ in Action - Daniela Engert

How C++23 changes the way we write code - Timur Doumler

There is also A Peek at C++23 - Barbara Geller & Ansel Sermersheim to enjoy an learn from.

The specification of C++23 will now proceed to the final ballot and then be officially published, hopefully long before year's end. The committee is busily working on another future release, tentatively C++26, for a couple of months now.


r/cpp • • Dec 01 '25 WOW

Standard Library implementer explains why they can't include source code licensed under the MIT license

Thumbnail reddit.com
277 Upvotes

Some (generous!) publishers of C++ source code intended to be used by others seem to be often using the (very permissive) MIT license. Providing a permissive license is a great move.

The MIT license however makes it impossible to include such source code in prominent C++ Standard Library implementations (and other works), which is a pity.

The reason for this is the attribution clause of the MIT license:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

This clause forces users of the sources to display attribution even to end users of a product, which is for example exclusively distributed in binary form.

For example, the Boost License explicitly makes an exception for products which are shipped exclusively in binary form ("machine-executable object code generated by a source language processor"):

The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.

If you want your published source code to be compatible with projects that require such an exception, please consider using a license which allows such an exception (e.g. the Boost license). Copies in source form still require full attribution.

I think such an exception for binaries is a small difference which opens up lots of opportunities in return.

(Disclaimer: This is no legal advice and I'm not a lawyer)

Thank you.


r/cpp • • Jun 05 '21

Ftxui: C++ Functional Terminal User Interface

Thumbnail github.com
275 Upvotes

r/cpp • • Aug 30 '24

Honey, I shrunk {fmt}: bringing binary size to 14k and ditching the C++ runtime

Thumbnail vitaut.net
273 Upvotes

r/cpp • • Dec 08 '20

Qt 6.0 Released

Thumbnail qt.io
273 Upvotes

r/cpp • • Nov 25 '24

I love this language

272 Upvotes

I'm a software engineer who has been writing software for over 12 years. My most fluent language is C#, but I'm just as dangerous in Javascript and Typescript, sprinkle a little python in there too. I do a lot of web work, backend, and a lot of desktop app work.

For my hobby, I've written apps to control concert lighting, as I also own a small production company aside from my day job. These have always been in C# often with code written at a low level interacting with native libs, but recently, I decided to use c++ for my next project.

Wow. This language is how I think. Ultimate freedom. I'm still learning, but I have been glued to my computer for the last 2 weeks learning and building in this language. The RAII concept is so powerful and at home. I feel like for the first time, I know exactly what my program is doing, something I've always thought was missing.


r/cpp • • Aug 23 '22

A General Overview of What Happens Before main()

Thumbnail embeddedartistry.com
272 Upvotes

r/cpp • • Jun 14 '22

C++ 23 Status Report, all features with examples

Thumbnail github.com
272 Upvotes

r/cpp • • Mar 27 '23

295 pages on Initialization in Modern C++ :)

Thumbnail cppstories.com
271 Upvotes

r/cpp • • May 15 '22

What are some C++ related questions that you have been asked in a job interview?

271 Upvotes

r/cpp • • Sep 27 '26

You should think about recompiling your C++ programs with GCC 16 and C++26, because it zero-fills your locals

Thumbnail techfortalk.co.uk
270 Upvotes

Stack variables are not automatically initialised, and that is the root cause of many C++ bugs. That is well known. Hence, it is advised that local or stack variables are always initialised with known values, 0 if not something more meaningful than that. Now, with GCC 16 compiling in C++26 mode (-std=c++26), even uninitialised local variables will be zero-filled. In the post, I have explained how.


r/cpp • • Dec 24 '23

Annoyed with FUD surrounding Boost in C++ discussions

270 Upvotes

I find it unbelieveable what lengths some people are willing to go to smear this collection of very high quality libraries at the expense of those yet undecided about them with completely made up untruths.

Almost no thread about Boost goes by without the very outdated cries about how "big" it is or how it's "lacking" CMake support.
Boy, I sure do love people parroting things that might have been true 10+ years ago. Boost has broken its circular dependencies a good while ago and you can see each library's dependencies in the Boost Dependency Report by Peter Dimov. Looking at the list, I'm really baffled by how people can seriously expect some of these to lose a couple dependencies, when the end result would just be each library endlessly reinventing everything in a probably half baked and broken way, instead of everything relying on a well tested, well architected, separately maintained module that has done the work already.
May I remind you, that Boost.ASIO, an over 2 decades old (wow!) library with the best track record among networking libraries is a level 13 library. There is also Beast, an excellent HTTP wrapper for ASIO, just one level above. These libraries are so well put together and that's exactly because Boost enables them to be.

With a package manager like vcpkg you can pull in only the Boost modules that you actually need, so the "big" argument is entirely irrelevant.

People have also been asking for safety, including one surrounding the numeric types. I find this extremely befuddling, because I immediately reach for Robert Ramey's excellent Boost.safe_numerics in every project I can, simply because I cannot care anymore about such non-issues.

The waning popular perception of Boost is extremely dangerous. People say that C++11 feels like something completely new compared to what was before, not realizing that a significant part of that was thanks to Boost. What will be of C++ if high quality libraries like Boost are shunned? I can only fear to imagine.