C++ - Reddit
Відкрити в Telegram
Stay up-to-date with everything C++! Content directly fetched from the subreddit just for you. Join our group for discussions : @programminginc Powered by : @r_channels
Показати більше229
Підписники
+124 години
+17 днів
+230 день
Архів дописів
229
Apart from contributing to open-source projects, what are some autonomous driving or telecommunications projects one can attempt?
Something thats is not mentioned in Build Your Own X.
1. What were the steps you took when you switched to or started your career in A) Autonomous Driving Software or B) Telecomms?
2. What do you hope your juniors or interns would know before joining or when they were working with you on a software?
https://redd.it/1jflxks
@r_cpp
229
Breaking down bugs in TDengine to master refactoring, part 2: stack-consuming macro
https://pvs-studio.com/en/blog/posts/cpp/1238/
https://redd.it/1jfiprh
@r_cpp
229
C++26: Deprecating or removing library features
https://www.sandordargo.com/blog/2025/03/19/cpp26-deprecate-remove-library-features
https://redd.it/1jfiv5x
@r_cpp
229
Music industry
I’ve been coding for about 5 years now as a junior in high school and recently my stepmom has really wanted me to go to college and get into ai tech startups. Although I kinda agree with her, I’d rather skip college and get some internships this summer at some startups and then when I graduate high school, join a startup and then perhaps make my own. The issue arises where she really sees college is worth it but I don’t see it that way and I’m also the worst at standardized testing. I’m just wondering, since I’ve always been big into music and tech, are music industry startups around and are they big? Would it be worth joining them instead of college? I feel that my skills of c++ are pretty subpar as the language is soooo complicated and the quirks to learn take so long but I’m definitely trying to become better. I also have a background of languages besides c++ like python and rust and little bit of js but I don’t enjoy javascript. Please give me some insight!
https://redd.it/1jffo5l
@r_cpp
229
CopperSpice: std::launder
https://isocpp.org/blog/2024/11/copperspice-stdlaunder
https://redd.it/1jff3qa
@r_cpp
229
A collection of safety-related papers targeting more safety for C++ in March WG21 list
Profiles and contracts-specific:
- Core safety profiles: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3081r2.pdf
- Implicit assertions, prevent UB by default: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3558r1.pdf. TL;DR: make bounds and dereference safe by default.
- Framework for C++ profiles: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3589r1.pdf
UB-specific:
- Initial draft for UB whitepaper (this is a call to action + work methodology): https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3656r0.pdf
- Make contracts safe by default: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3640r0.pdf
Std lib-specific:
- Standard library hardening: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3471r4.html
Annotation for dereferencing detection:
- Invalidate dereferencing: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3442r1.pdf
https://redd.it/1jfcwzx
@r_cpp
229
Bjarne Stroustrup: Note to the C++ standards committee members
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3651r0.pdf
https://redd.it/1jf75zj
@r_cpp
229
[Concepts] Is there a technical reason we cannot use static_assert in a requirement-seq?
I've been pretty happy that simple-requirements are so successfully simple, e.g.
template <typename F, typename P>
concept SingleArgument = requires(F f, P p)
{
f(p);
};
I read that very much like "if `f(p);` compiles, `F` and `P` satisfy `SingleArgument`.
But for some reason that doesn't include `static_assert`
template <typename F, typename P>
concept UnaryPredicate = requires(F f, P p)
{
f(p);
// doesn't compile:
static_assert( std::is_same_v<decltype(f(p)),bool> );
};
- clang: ` error: expected expression`
- gcc: ` error: expected primary-expression before 'static_assert'`
- msvc: ` error C2760: syntax error: 'static_assert' was unexpected here; expected 'expression'`
I mean I guess? I've never really had to think about what type of thing `static_assert` actually is. Guess it's not an expression.
Now there are ways around it of course, where you stop using simple requirements:
- compound requirement:
- `{ f(p) } -> std::same_as<bool>;`
- I understand this *now* but that took some reading. Especially when I looked up `std::same_as` and realized it takes *two* parameters and my required return type is the *second* parameter.
- Originally I thought I had to fill in both, using `decltype` to get my return type like `std::same_as<decltype(f(p)),bool>`
- home-made compund requirement:
- `{ f(p) } -> snns::returns<bool>;`
- it's a bad name in a vacuum but it's pretty obvious what it does when seen in a constraint-expression
- type requirement:
- `typename std::enable_if_t<std::is_same_v<decltype(f(p)), bool>, int>;`
- I don't love it. I do not love it.
- my concept users are going to see that and think "...what?"
- I'll be honest here, *I* am going to see that and think "...what?"
- what is that `int` even doing there? It is up to no good I bet.
- Macros!
- everybody loves macros
- we definitely need more in the language
template <typename F, typename P>
concept UnaryPredicate = requires(F f, P p)
{
f(p);
SNNS_FUNCTION_RETURNS_TYPE( f(p), bool );
};
where `SNNS_FUNCTION_RETURNS_TYPE` is:
#define SNNS_FUNCTION_RETURNS_TYPE( FUNCTION, TYPE)\
typename \
std::enable_if_t < \
std::is_same_v < \
decltype( FUNCTION ), \
TYPE \
>, int> // here's int again!
though I guess I could have done it with a compound-expression also?
#define SNNS_FUNCTION_RETURNS_TYPE( FUNCTION, TYPE)\
{ FUNCTION } -> TYPE
But getting back around, this doesn't compile:
template <typename F, typename P>
concept UnaryPredicate = requires(F f, P p)
{
f(p);
static_assert( std::is_same_v<decltype(f(p)),bool> );
};
So...
> **[Concepts] Is there a technical reason we cannot use static_assert in requirement-seq?**
https://redd.it/1jezdkk
@r_cpp
229
C++ Dynamic Debugging: Full Debuggability for Optimized Builds
http://aka.ms/dynamicdebugging
https://redd.it/1jf456s
@r_cpp
229
YesChief! - a c++23 library for your CLI
The repository: https://github.com/Gashmob/YesChief
Hi everyone! Let me share my last project. I've recently discovered
std::expected and std::optional and wanted to use it for my argv parser, so there it is.
The concept: when you use use cli.run(argc, argv) it returns you a std::expected containing an object on which you can query your cli options with result.get("option_name"). This last method returns a std::optional with the value of the option.
With this library you can define options or commands for your cli, and commands can have their own inside cli with options or commands...
A doxygen documentation is also available with a section on the usage.
I can't wait to read your thoughts!
https://redd.it/1jf1x3m
@r_cpp229
A small cmake script to combine static libraries
Hello, I've written a small CMake function script to combine the static libraries compiled from my SDK project. Here is the git repo: https://github.com/kesco/static-libraries-combiner
# include the combiner cmake file
include(${CMAKE_SOURCE_DIR}/../combiner.cmake)
# use the function to combine the libraries
combine_static_libraries(${TARGET_LIB} ${TARGET_LIB}_Bundle)
# direct link to the combined library
target_link_libraries(${EXECUTABLE} ${TARGET_LIB}_Bundle)
I hope these will be as useful.
https://redd.it/1jez4gm
@r_cpp229
Don't understand what happens when returning a local object
I made a small test sample (here at godbolt) that illustrates my misunderstanding. I would expect the
A a{} in make_A as well as the new A(make_A()) to create an A instance. I read the `new A(make_A())` as 'use A's copy constructor, and put an instance on the heap'
However this does not seem the case, only one instance is created, and its address is contained in the pointer in main(). Is this some compiler optimization, or a C++ feature?
#include <iostream>
using std::cout;
int I = 0;
class A {
public:
int i=0;
A():i(++I) { cout << "A#" << i << " created at address " << this << "\n"; }
~A() { cout << "A#" << i << " at address " << this << " deleted\n"; }
};
A makeA() {
A a{};
a.i=8;
cout << "here " << &a << "\n";
return a;
}
int main() {
{
A *a = new A(makeA());
cout << "a->i = " << a->i << "\n";
cout << "a = " << a << "\n";
delete a;
}
}
https://redd.it/1jez6uk
@r_cpp229
Introducing the Conan audit command for scanning C++ CVEs
https://blog.conan.io/introducing-conan-audit-command/
https://redd.it/1jeyrt7
@r_cpp
229
How Build Insights Reduced Call of Duty: Modern Warfare II’s Build Times by 50%
https://aka.ms/BuildInsightsMW2
https://redd.it/1jeo5wv
@r_cpp
229
Automating recovering data from a crash dump
Hey gang - I'd like to get some perspective on just how hard this would be to do.
My company has an application that we sell to customers that's written in C++. It collects data from various sources and writes the data to an external system. It batches the data up in memory and writes the data periodically.
If the application crashes, all that data is lost, which of course makes customers unhappy.
I had a shower thought this evening...Is it possible to write an application that could automate extraction of data from a crash dump file? Or, could one 'script' actions against a debugger attached to the crash dump file to extract the data?
Just curious how crazy of an idea this is. Thanks!!
https://redd.it/1jemgqw
@r_cpp
229
Introducing cforge – A TOML-Based Build System for C/C++ Projects
Hi everyone,
I’m excited to share cforge, a new build system I’ve been working on that aims to simplify building C/C++ projects. cforge leverages a TOML-based configuration to streamline your build workflow while seamlessly integrating with popular tools like CMake and vcpkg.
What cforge offers:
TOML-Based Configuration: Easily define your build settings in a clear, human-readable format.
CMake Integration: Automatically generate CMake build files, so you can continue using a familiar system.
vcpkg Integration: Manage your dependencies without the usual hassle.
Ease of Use: Designed with simplicity in mind to reduce boilerplate and setup time.
I built cforge to address some of the common frustrations with traditional build systems and hope it can save you time and effort in your projects. Since it’s still in the early stages, I’m looking for feedback, feature suggestions, and any bug reports you might encounter.
You can check out the project on crates.io and find more details in the repository linked there.
I’d love to hear your thoughts—what build system pain points do you face in your projects, and how can cforge evolve to address them?
https://redd.it/1jeld1p
@r_cpp
229
2025-03 post-Hagenberg mailing
I've released the hounds. :-)
The post-Hagenberg mailing is available at https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/#mailing2025-03.(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/#mailing2025-03)
The 2025-04 mailing deadline is Wednesday 2025-04-16 15:00 UTC, and the planned Sofia deadline is Monday May 19th.
https://redd.it/1jekuxe
@r_cpp
229
MV: A Real-Time C++ Memory Visualization Tool for Beginners
Hey everyone,
I wanted to share a tool I've been working on that helps beginners **visualize how C++ code affects memory (stack + heap) in real time.** This proof of concept is designed to make memory management easier to understand.
**Key Features**:
* See how variables affect the **stack** instantly
* Visualize **heap allocations** and **pointers** with arrows
* Detect **memory leaks** and **dangling pointers** in real time
This tool isn’t meant to replace solutions like PythonTutor but serves as a **real-time learning aid** for students To achieve this, we intentionally do not support nor plan to support certain C++ features that are incompatible with the real-time approach.
Your feedback is valuable for improving the tool. Since there may be bugs, test it with a beginner’s mindset and share what would have helped you when learning C++. When you open the tool, you'll find a brief tutorial to help you get started. Also, let me know any suggestions or features you’d like to see.
**Tool Link:** [https://mv-beta-eight.vercel.app](https://mv-beta-eight.vercel.app/)
**Feedback Form:** [https://forms.gle/uyuWdiB8m1NuTbMi8](https://forms.gle/uyuWdiB8m1NuTbMi8) (also available in the tool)
https://redd.it/1jdxnw5
@r_cpp
229
C++ Desktop Project with GitHub Copilot and Visual Studio 2022
https://youtube.com/watch?v=lYT2IZLvpds&si=ZLWoECcLl4uoCK2e
https://redd.it/1je4zwc
@r_cpp
229
If extern non-inline was removed as an option, would there be a downside?
As I understand it, while inline used to mean something else, nowadays it only means externally linked but tolerating multiple identical definitions instead of requiring exactly one definition. What if all extern variables were made inline? Would there be a downside?
https://redd.it/1je2udm
@r_cpp
Вже доступно! Дослідження Telegram за 2025 — головні інсайти року 
