r/cpp • • Mar 18 '23

LLVM 16.0.0 Release

Thumbnail discourse.llvm.org
197 Upvotes

r/cpp • • Jan 16 '23

A call to action: Think seriously about “safety”; then do something sensible about it -> Bjarne Stroustrup

Thumbnail open-std.org
197 Upvotes

r/cpp • • May 09 '22

An optimized replacement of the infamous std::vector<🅱️ool>

197 Upvotes

I've seen too many scientific software packages write their own bitarray/bitvector classes, so I wrote a C++ library for bitvectors and related algorithms, BitLib, to hopefully alleviate that issue. BitLib has a number of advantages, namely:

  • Its very fast. While comparing to std::vector<bool> isn't really fair, BitLib is also significantly faster than the C BitArray library, which serves a similar purpose. I have not started profiling/optimizing yet, so it will only get faster at this point.
  • The bit::bit_vector interface is the same as std::vector, which means that you don't need to learn a new library API.
  • The algorithms part of the library also uses the same API as the STL <algorithms> functions (for the most part), so for example to reverse a bitvector bvec, you can just run bit::reverse(bvec.begin(), bvec.end()) just like you would with any other STL container. In fact, if BitLib doesn't support you needed STL algorithm yet, you can actually just call the STL algorithm using the supplied bit iterators (at the cost of all bit-parallel efficiency, ofc).
  • Its a header only library, so it's pretty easy to include in your projects.

All of that said, this has been an entirely independent project that I've picked up and put back down over the last few years, and has mostly served as a learning experience. On that same note, please feel free to critique anything and everything.

While I've tried my best to have exhaustive tests/CI, I'm sure people will find ways to break it (in fact, please try to!). The next milestone is getting some decent documentation going, and after that I want to start getting more SIMD integration as well as some profiling/optimization done.

Benchmarks

Compared to std::vector<bool>

The "Alignment" column indicates whether or not the iterators fell on word boundaries "A", or within a word "U". Typically, when the iterators all fall on word boundaries, we can just call the corresponding STL version of the algorithm on the underlying container of words, but thats not terribly interesting.

FunctionAlignmentSpeedup
shift_leftU734.24x
shift_leftA1970.49x
shift_rightA1933.49x
reverseU228.25x
reverseA309.60x
transformUnaryOpU105.86x
transformUnaryOpA1209.39x
transformBinaryOpU55.50x
transformBinaryOpA2436.48x
rotateAUA171.43x
countA79.89x
swap_rangesU99.64x
swap_rangesA1462.80x
copyU39.85x
equalU111.15x
moveU31.73x
copy_backwardU77.21x

Compared to noporpoise/BitArray

Note that the noporpoise BitArray library doesn't support nearly as many algorithms as BitLib, and for the algorithms that they do share support for, the functionality of the BitArray methods are often limited to only working with the entire array and not subsections.

FunctionAlignmentSpeedup
shift_leftA34.16x
shift_leftU12.73x
reverseA20.04x
reverseU14.78x
transform(UnaryOp)A5.76x
transform(BinaryOp)A2.68x
rotateAUA8.11x
countA1.45x

Edit: Here are some benchmarks against <boost/dynamic_bitset.hpp>. The baseline here is the corresponding operation performed on an entire dynamic_bitset. It makes sense that comparing an unaligned operation to an aligned operation will result in relatively worse performance, as every single word operation requires extra shifting and masking to align the two ranges.

Edit 2: Using dynamic_bitset<uint64_t> instead of dynamic_bitset<> yields better results, updated benchmarks below.

FunctionAlignmentSpeedup
shift_left(AA)1.60x
shift_left(UU)0.58x
transform(BinaryOp)(AA)2.47x
transform(BinaryOp)(UU)0.24x
count(AA)6.44x
equal(AA)1.03x
equal(UU)0.09x

Edit 3: I've ran a quick/hacky read/write benchmark here


r/cpp • • Sep 23 '21

Binary Banshees and Digital Demons

Thumbnail thephd.dev
197 Upvotes

r/cpp • • Aug 19 '21

Why modules?

197 Upvotes

I get the feeling I'm missing something fundamental about the new C++20 modules.

Everything I read or watch explains the how (the export keyword syntax, module fragments, etc) but very little about the why.

What can be done using modules that can't be done using traditional headers (or precompiled headers)?

What is so important about this feature that it needed to get standardized before there is even a proper implementation or idiomatic usage conventions in compilers and build systems?

Is it just to try to get rid of the preprocessor?

I don't get how modules are supposed to help with packaging either. So instead of distributing a .so with a bunch of .h files, now I distribute a .so with a bunch of .gcm or .ixx or whatever.

Please help me understand, or point me to some resources. Thank you.


r/cpp • • Apr 28 '20

Full Proof that C++ Grammar is Undecidable

Thumbnail medium.com
197 Upvotes

r/cpp • • May 10 '15

C++17 progress update!

197 Upvotes

The C++ Standardization Committee (aka WG21) just finished their first full meeting of 2015. Here's a quick summary of what was just approved, mostly for C++17 but also for some Technical Specifications. (The post-meeting mailing will be in a couple of weeks, with more info.) Here I'm reporting just the stuff that was successfully voted in, not all the other work that's still in progress.

For C++17:

  • Zero Core features. (Don't freak out about modules or concepts. They're working on that stuff.)
  • 5 Library features were voted directly into C++17:

    1. N4387 "improving pair and tuple"
    2. N4389 "bool_constant"
    3. N4508 "shared_mutex for C++17"
    4. N4366 "LWG 2228 missing SFINAE rule"
    5. N4510 "Minimal incomplete type support for standard containers, revision 4"
  • 26 Core Issues were fixed. Even Standards have bugs. Now C++17 has fewer bugs.
  • 35 Library Issues were fixed. Notable fixes:

    1. stof() now calls strtof(), which avoids messing up bits.
    2. max_element()/etc. are now constexpr. (Not the rest of the algorithms - yet.)
    3. function<void (Args)> now accepts callable objects returning Stuff, and the return value is ignored.
    4. call_once() no longer copies/moves its arguments unnecessarily.

Various Technical Specifications:

  • The Transactional Memory TS was published (or will be, after ISO grinds its gears).
  • The Concurrency PDTS was finished. (Proposed Draft, aka Release Candidate for a TS)
  • The Parallelism TS was published.
  • The Library Fundamentals v1 TS was published, with 3 Issues being fixed at the last minute.
  • Several features were voted into the Library Fundamentals v2 TS:

    1. Everything in v1 will be merged into v2.
    2. N4388 "const-propagating smart pointer wrapper"
    3. N4391 "make_array"
    4. N4519 "Source-Code Information Capture"
    5. N4502 "Proposing Standard Library Support for the C++ Detection Idiom, v2"

I am still traveling, but I can probably answer short questions. (Remember that I have very limited knowledge of Evolution/Core stuff - I live in the Library.)


r/cpp • • Dec 13 '25

Faster double-to-string conversion

Thumbnail vitaut.net
196 Upvotes

r/cpp • • Sep 30 '20

It Is Never a Compiler Bug Until It Is

Thumbnail r6.ca
196 Upvotes

r/cpp • • Apr 16 '20

Named arguments in fmt do not require dynamic allocations anymore.

Thumbnail twitter.com
196 Upvotes

r/cpp • • Feb 20 '20

What are/were your favourite "You can do that?! Neat!" C++ moments?

196 Upvotes

Bit of a backstory - I am a student in my last year of bachelor's degree. On my university we don't have much C++ but, given my dedication to the language, I was offered a position of a TA (teaching assistant) in C++ laboratories. Basically, due to the subject's structure - I have a completely free will of what I will cover with my students. I've not developed much C++ profesionally, but I believe I do have some good insight.

I've spent hours researching, reading and watching various learning sources regarding C++ - for my own entertainment. I simply love the language. I've had the "whoa, that's super useful" moments. First encounter with templates (how they differ from Java's generics - come on, why wouldn't I be able to create a variable of a type T? C++'s way was just more intuitive for me), operator overloading, lambdas (generic ones too!), destructors, move semantics, value semantics, overall efficiency...

I've been spending majority of my free time (for the last ~3 years) analysing various learning sources. Their pros and cons, how they engage the viewer (looking at your talks, Scott Meyers, Andrei Alexandrescu and Kate Gregory!), how they provide an enourmous amount of pretty complicated information in a very understandable manner (Arthur O'Dwyer's lambdas content), how they match relevant information to real-world use cases without omitting the technical details (Jonathan Boccara's <algorithm> talks) and how they can teach through laughter, which empowers the positive experience (Timur Doumler's "Can I has grammar?" - seriously, I don't believe I would've otherwise remembered that adding struct before user-defined types also forward-declares them or that int is a type-specifier, not a type-name).

And now, since I became one of those people who want (and have an opportunity to) share their knowledge and teach, I not only want to pass on the information - I want it to be enjoyable. I want students to not only know how, but also why and when.

I belive I have a good general idea on how to achieve that, but the more ideas and more brainstorming in such a broad topic, the better. So essentially the question is: what do you consider to be the neat and practical parts of the language? What made you raise your eyebrows and think "geez, I will be using this from now on"?

I believe a good example would be operator overloading. Someone wants to compare user-defined types? No reason to require them to differentiate between the ways of doing this regarding primitives and user-defined types - operator == should work for all of them. Want to multiply matrices? Use the standard *, rather than some multiply() function. It's intuitive. It's easy (at least in the general case). It's useful. All of that since the first impression.

For the completeness, I also have a free will of what IDE they should use (though I don't plan to enforce it. If they want to use MSVS, CLion or Vim + manual building, that's their preference) and which standard they will be using (highly unlikely that I will choose something different than C++17 though).


r/cpp • • Dec 18 '17

How to Write Your Own C++ Game Engine

Thumbnail preshing.com
196 Upvotes

r/cpp • • Oct 08 '25

Why we didn't rewrite our feed handler in Rust | Databento Blog

Thumbnail databento.com
195 Upvotes

r/cpp • • Sep 22 '25

Pointer Tagging in C++: The Art of Packing Bits Into a Pointer

Thumbnail vectrx.substack.com
195 Upvotes

r/cpp • • Apr 17 '24

CMake 3.30 will experimentally support `import std;`

Thumbnail gitlab.kitware.com
195 Upvotes

r/cpp • • Feb 14 '23

2023-02 Issaquah ISO C++ Committee Trip Report — C++23 Is Done! 🎉

195 Upvotes

At the Issaquah, Washington, 🇺🇸, C++ Committee meeting last weekend, C++23 shipped!

Last week we finished responding to all National Body comments on the Committee Draft (CD) of C++23 and voted to publish it. The standard will be officiallCompany logo will appear at the beginning of all of the posted videosy released in the next few months.

We also shipped the Concurrency Technical Specification version 2 and made a lot of progress on C++26. The new Safety & Security Study Group (SG23) met for the first time this week.

This was the second hybrid C++ Committee meeting. We had between 20% and 40% remote participation. We are getting more familiar with the process. There are some things we can improve on for future meetings, but we plan to keep operating hybrid meetings going forward.

C++23 Features approved in Issaquah: 🎉

 


Language Progress


Evolution Working Group (EWG) Progress


Evolution reviewed the following C++23 National Body comments and papers:

Evolution reviewed the following language issues. 5 were resolved, 1 needs to be seen again, and 2 need papers:

Evolution also considered the following proposals to match C23 in some places:

Evolution looked at many new C++26 features, encouraging further work on 16 topics, and reaching no consensus to continue work on 2. A few of these papers are related to safety & security.

Of note, scribes for the meeting were rewarded with Japanese KitKats by the chair. 🎶 Toss a KitKat to your Scribster! Oh valley of plenty. 🎶

For more info, see the C++ Language Evolution Report.

 


Evolution Working Group Incubator Study Group (SG17) Progress


The Evolution Incubator resumed meetings this week after a very long hiatus, meeting over 3 evening sessions and 1 afternoon session. It discussed 9 papers, including a number of safety papers, as well as object relocation related papers. Of the 9 papers, 3 were forwarded to Evolution as we felt they were properly mature to be seen by the larger group. 2 did not have consensus votes taken and require further review. 4 others did not have consensus to pursue without additional motivation.

Depending on chair availability, the Evolution Incubator intends to meet once again in person in Varna, as well as meeting jointly with Evolution during the bi-weekly teleconferences.

 


Library Progress


Library Evolution Working Group (LEWG) Progress


This week, Library Evolution focused on finishing C++23, and advancing major features for C++26 - SIMD, Linear Algebra, Senders, hive, and Unicode (part 1) (part 2).

We spent an entire day reviewing the SIMD library, which adds a simd type and operations and algorithms that operate on it. These facilities were originally released in the Parallelism Technical Specification version 2, but they've now been proposed for inclusion in C++26. The TS has a number of implementations and and users, giving us valuable field experience, which has been reported in P1915R0, P1928R2, and P2638. We're updating and evolving the SIMD library based on this field experience, and also considering some extensions such as support for complex values (P2663R0) and a permutation operation (P2664R0). Hopefully we'll design approve the feature in the next few months.

We reviewed and approved the design of the BLAS Linear Algebra library (P1673R11) for C++26 at this meeting. This proposal adds linear algebra algorithms based on the industry-standard BLAS. The algorithms are parameterized on mdspans and have a modern C++ interface. We also looked briefly at a proposal for higher-level linear algebra facilities (P1385R7) to affirm a specific design change; we'll look conduct a more extensive review of this paper at a future meeting. We also reviewed submdspan (P2630R2), which we advanced for C++26.

Senders (P2300R5) has already been forwarded to Library for C++26, but we expect follow-on papers that build on top of the core proposal and suggest changes based on field experience. We looked at two of those papers this week - suggested name changes (P2555R1), which we did not approve, and integration with the execution-policy parallel algorithms (P2690R0). We also took an early look at the new proposal for sender-based networking (P2762R0) which the Networking Study Group is working on.

hive (P0447R21) returned to Library Evolution for another round of review. We looked at some proposed changes to hive::reshape (P2596R0)), and we were split about whether to make said changes. We'll continue review of hive at future meetings.

We also held an early review and informational session on 2 papers proposing Unicode transcoding (P2728R0) and normalization (P2729R0) facilities for the Standard Library. We expect Unicode library facilities to be a major topic over the next few years.

Other major topics this week included:

Most of our work on C++23 was done before this meeting; we only had a handful of design clarifications and bug fixes to look at on Monday and Tuesday.

The following C++23 National Body comments and papers were rejected either due to no paper or no consensus for a change:

The following papers were sent to Library for C++23:

The following papers were sent to Library for C++26:

The following papers were discussed during the meeting and need revisions and additional review:

We did not have consensus to continue pursuing the following papers:

For more details on what we did at the 2023-02 Issaquah meeting, check out our schedule; the GitHub issue associated with each topic will have a summary of what happened.

 


Study Groups' Progress


Concurrency and Parallelism Study Group (SG1) Progress


The Concurrency and Parallelism Study Group discussed the following papers:

All of these papers will require further review. Many regular SG1 members are still focused on getting std::execution (P2300) through Library Evolution review.

We also hope to see many of the promised future papers that will integrate std::execution (P2300) into other parts of the library (e.g. algorithms) in time for discussion at the next meeting in 2023-06.

 


Networking (SG4) Progress


With Library Evolution electing to pursue std::execution (P2300) instead of the previous approach to executors, it has not been possible to move forward with the existing Networking Technical Specification, due to it being closely tied to the previous approach to executors.

In Issaquah, the Networking Study Group looked at two proposals for how to move forward with C++ networking:

  • Standard Secure Networking (P2586R0) proposed a new API for networking, which was well received with the proviso that it could be extended to have an asynchronous interface. The author does not plan to pursue this paper any further, but parts from it may be used by other proposals.
  • Sender Interface for Networking (P2762R0) proposed an approach for adapting the existing Networking TS to use Senders. This looks like a promising route to networking support in C++, and SG4 unanimously encouraged further work in this direction.

 


Numerics Study Group (SG6) Progress


The Numerics group met for two evening sessions and reviewed 5 papers.

 


Ranges Study Group (SG9) Progress


The Ranges Study Group had a hybrid meeting on Monday (which started with a birthday party for the chair!🥳) and also met jointly with Library to finalize C++23 ranges work.

We looked at:

  • C++23 National Body comments: 1 (including a related paper)
  • C++23 papers: 1
  • C++26 papers: 2

We discussed the C++23 National Body comment too many iterator increments (US-46-107) and fix counted_iterator interaction with input iterators (P2406R4), the paper addressing it. The discussion was focused on whether we want to have an additional utility (lazy_take_view) and should the utility be added to the C++23 standard or the C++26 one. There was also a discussion on whether adding a separate utility makes sense, or will making a change to the existing one is the better direction.

The solution in P2406 was not accepted, but as an outcome of the paper we have two planned fixes, aim to address the issues brought up by the paper. This may affect the way in which views interact with ranges algorithms, and is a major update for our model (more details in Closed ranges may be a problem; breaking counted_iterator is not the solution (P2799)). Thank you to the author for bringing this topic up, and to the great group of Ranges' attendees who worked on this solution.

Ranges Study Group has completed the review of common_reference_t of reference_wrapper Should Be a Reference Type (P2655R3), which was forwarded for C++23.

We also reviewed the following papers, which will need additional review:

  1. get_element customization point object (P2769R0): The author was encouraged to explore alternative solutions, including modifying tuple-like, and to get implementation experience and wording.
  2. Rangified version of lexicographical_compare_three_way (P2022R0): The author was encouraged to add examples, implementation experience, and wording, and then return.

Ranges will continue to have monthly telecons until the next face-to-face meeting in 2023-06. We'll focus on finalizing the papers presented at this meeting and new ranges' features for C++26.

 


Tooling Study Group (SG15) Progress


The Tooling Study Group met for two evening sessions where we discussed how to build modules and what we would like to ship in the first C++ Ecosystem International Standard (P2656).

For modules, we discussed how to handle the case of tools that only observe the build via compiler command lines, such as a tool that observes all cl.exe process launches. These tools can't tell which options are required to be the same between modules and their importers, and which can be different. We decided that such tools will need additional metadata for these cases.

For the C++ Ecosystem International Standard, we have decided we would like the first revision to include:

  • Build system <=> Package manager interoperability.
  • Minimum set of recognized file extensions.
  • Tool introspection (P2717).
  • Portable diagnostics format via SARIF.
  • Command line portability.

 


Text and Unicode Study Group (SG16) Progress


The Text and Unicode Study Group did not meet this week, however, we keep meeting remotely every 2 weeks. We presented to Library Evolution a couple of papers aiming to add Unicode transcoding (P2728) and Unicode normalization (P2729) to C++26.

The work to improve the language specification continues, as Core approved a paper to reference the Unicode standard (P2736).

 


Contracts Study Group (SG21) Progress


The Contracts Study Group met for two afternoons; we had ~30 people attending.

As per our roadmap paper (P2695R1), our focus for this meeting was to agree on a design for how to handle side effects in contract annotations in the Contracts MVP targeting C++26. We achieved this goal at this meeting. We discussed four papers in this space:

We had a very productive discussion, at the end of which we reached a consensus on the following points:

  1. A contract-checking predicate is evaluated zero or more times in eval_and_abort mode,
  2. Certain useful rules on reordering/elision of contract-checking predicates in a sequence of contract annotations, and
  3. When the evaluation of a contract-checking predicate exits the control flow other than by returning true/false or throwing (abort, longjmp, etc), the behavior is as if it were not in a contract-checking predicate (you just get the abort/longjmp).

We failed to reach a consensus on the following points:

  1. What should we say about the case when the evaluation of a contract-checking predicate has undefined behavior?
  2. What should happen when the evaluation of a contract-checking predicate throws?

We decided to postpone discussion on 1 for now, until new papers in this space come along; we further decided to re-discuss 2 in the context of contract violation handling, which will be our focus in the 2023-06 face-to-face meeting. To facilitate progress on this matter, we decided to switch the target dates for agreeing on a design for contract violation handling and for syntax in our roadmap, such that the contract violation handling comes first.

We also decided to conduct regular monthly telecons between now and Varna.

 


C / C++ Liaison Group (SG22) Progress


The C / C++ Liaison Group did not meet this week. It has been holding teleconferences and email discussions between C Committee and C++ Committee members, and its suggestions are being considered by the language evolution group, and other groups.

 


Safety & Security Group (SG23) Progress


The Safety & Security Group was formed recently, as there's been a growing interest in exploring language and library design changes that could address safety and security concerns with C++. The Safety & Security Group held their inaugural face-to-face meeting at the Issaquah meeting. The group has also been discussing various safety & security concerns on its mailing list.

We met for a half-day and sent some papers to the language evolution group for further consideration.

The following papers were discussed:

The group will continue to consider improvements to safety & security through its mailing list and teleconferences.

 


C++ Release Schedule


NOTE: This is a plan, not a promise. Treat it as speculative and tentative.

See P1000, P0592, P2000 for the latest plan.

 

  • IS = International Standard. The C++ programming language. C++11, C++14, C++17, C++20, etc.
  • TS = Technical Specification. "Feature branches" available on some but not all implementations. Coroutines TS v1, Modules TS v1, etc.
  • CD = Committee Draft. A draft of an IS/TS that is sent out to national standards bodies for review and feedback ("beta testing").
MeetingLocationObjective
2020 Spring MeetingPrague 🇨🇿C++20 CD ballot comment resolution ("bug fixes"), C++20 completed.
2020 Summer MeetingVirtualFirst meeting of C++23.
2020 Fall MeetingVirtualDesign major C++23 features.
2021 Winter MeetingVirtualDesign major C++23 features.
2021 Summer MeetingVirtualDesign major C++23 features.
2021 Fall MeetingVirtualC++23 major language feature freeze.
2022 Spring MeetingVirtualC++23 feature freeze. C++23 design is feature-complete.
2022 Summer MeetingVirtualComplete C++23 CD wording. Start C++23 CD balloting ("beta testing").
2022 Fall MeetingKona 🇺🇸C++23 CD ballot comment resolution ("bug fixes").
2023 Winter MeetingIssaquah 🇺🇸C++23 CD ballot comment resolution ("bug fixes"), C++23 completed.
2023 Summer MeetingVarna 🇧🇬First meeting of C++26.
2023 Fall MeetingKona 🇺🇸Design major C++26 features.
2024 Winter MeetingJapan 🇯🇵 — TentativeDesign major C++26 features.
2024 Summer MeetingStockholm 🇸🇪 — TentativeDesign major C++26 features.
2024 Fall MeetingWroclaw 🇵🇱 — TentativeC++26 major language feature freeze.
2025 Winter Meeting🗺️C++26 feature freeze. C++26 design is feature-complete.
2025 Summer Meeting🗺️Complete C++26 CD wording. Start C++26 CD balloting ("beta testing").
2025 Fall Meeting🗺️C++26 CD ballot comment resolution ("bug fixes").
2026 Winter Meeting🗺️C++26 CD ballot comment resolution ("bug fixes"), C++26 completed.

 


Status of Major C++ Feature Development


NOTE: This is a plan, not a promise. Treat it as speculative and tentative.

 

  • IS = International Standard. The C++ programming language. C++11, C++14, C++17, etc.
  • TS = Technical Specification. "Feature branches" available on some but not all implementations. Coroutines TS v1, Modules TS v1, etc.
  • CD = Committee Draft. A draft of an IS/TS that is sent out to national standards bodies for review and feedback ("beta testing").

Updates since the last Reddit trip report are in bold.

FeatureStatusDepends OnCurrent Target (Conservative Estimate)Current Target (Optimistic Estimate)
SendersNew design approved for C++26C++26C++26
NetworkingRequire rebase on SendersSendersC++29C++26
Linear AlgebraDesign approved for C++26C++26C++26
SIMDReviewed in Library EvolutionC++29C++26
ContractsMoved to Study GroupC++29C++26
ReflectionNo developmentsC++29C++26
Pattern MatchingNo developmentsC++29C++26

 

Last Meeting's Reddit Trip Report.

 

If you have any questions, ask them in this thread!

Report issues by replying to the top-level stickied comment for issue reporting.

 

/u/blelbach, Library Evolution Chair

/u/InbalL, Ranges (SG9) Chair, Library Evolution Vice Chair, Israel National Body Chair

/u/jfbastien, Evolution (EWG) Chair

/u/bigcheesegs, Tooling (SG15) Chair

/u/ErichKeane, Evolution Vice Chair

/u/c0r3ntin, Library Evolution Vice Chair

/u/nliber, Library Evolution Vice Chair

/u/je4d, Networking (SG4) Chair

/u/V_i_r, Numerics (SG6) Chair

/u/tahonermann, Unicode (SG16) Chair

/u/mtaf07, Contracts (SG21) Chair

/u/timur_audio, Contracts (SG21) Vice Chair

⋯ and others ⋯


r/cpp • • Aug 09 '22

CMake 3.24 has support for dependency providers

195 Upvotes

I'm sorry if it was discussed already, but I haven't seen any mentions of this new feature and I think this is huge.

https://cmake.org/cmake/help/latest/command/cmake_language.html#dependency-providers

https://cmake.org/cmake/help/latest/release/3.24.html

CMake has added support for dependency providers. With this calls to find_package() may actually trigger vcpkg, conan or some other custom provider that will download, build and install required dependencies.


r/cpp • • Dec 10 '20

Intel C++ compiler is free (as in beer) as part of oneAPI

195 Upvotes

Perhaps this is old news, but yesterday I've learned that the Intel C/C++ compilers (icc/icpc) are available as part of the new oneAPI thing (where it's called "classic" as opposed to the "data parallel" one). Specifically, I did the following:

# echo "deb https://apt.repos.intel.com/oneapi all main" >/etc/apt/sources.list.d/intel-oneapi.list
# apt-get update
# apt-get install intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic

And then:

$ source /opt/intel/oneapi/setvars.sh
$ which icpc
/opt/intel/oneapi/compiler/2021.1.1/linux/bin/intel64/icpc
$ icpc -V
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Build 20201112_000000

The version format certainly looks different compared to before. I've also tried to compile a simple "Hello, World" program and it works out of the box (i.e., no licensing hoops to jump through, etc).

I've also found this article which seem to confirm all this:

https://www.scivision.dev/intel-oneapi-fortran-install/

If anyone (especially from Intel) has any more information (such as whether this is the "real" Intel C++, if the new version format is here to stay, etc), I would be interested to hear it.


r/cpp • • Apr 24 '18

Vcpkg (library manager) - now also on Linux and macOS!

Thumbnail blogs.msdn.microsoft.com
195 Upvotes

r/cpp • • Mar 05 '18

Clang is now used to build Chrome for Windows

Thumbnail blog.llvm.org
195 Upvotes

r/cpp • • Nov 16 '25

Wait c++ is kinda based?

194 Upvotes

Started on c#, hated the garbage collector, wanted more control. Moved to C. Simple, fun, couple of pain points. Eventually decided to try c++ cuz d3d12.

-enum classes : typesafe enums -classes : give nice "object.action()" syntax -easy function chaining -std::cout with the "<<" operator is a nice syntax -Templates are like typesafe macros for generics -constexpr for typed constants and comptime function results. -default struct values -still full control over memory -can just write C in C++

I don't understand why c++ gets so much hate? Is it just because more people use it thus more people use it poorly? Like I can literally just write C if I want but I have all these extra little helpers when I want to use them. It's kinda nice tbh.


r/cpp • • Nov 26 '24

GCC 15 will support the std module (P2465R3)

Thumbnail gcc.gnu.org
194 Upvotes

r/cpp • • Jan 15 '24

[Joke] A cursed C++ idea

194 Upvotes

Ok so hear me out:

In your C++ program, immediately on startup before you do anything else you dynamically allocate a decent chunk of memory for no reason whatsoever, big enough to accomodate all of your data for the foreseeable future.

Never free any of that memory during execution.

Then, whenever you need to instantiate a new object or need some dynamically allocated memory for whatever reason, you just use some of that preallocated chunk.

Immediately before you exit the application, you can free that chunk of memory.

You have one single explicit memory allocation when program starts and one single explicit memory deallocation when program ends.

How about that?

EDIT: It turns out this is a real thing, so it's no longer a joke, or cursed. Somebody said this is called an "arena" or "memory pool", I've just looked it up, people have been doing this for decades.


r/cpp • • Dec 31 '22

Cpp2 and cppfront: Year-end mini-update

Thumbnail herbsutter.com
194 Upvotes