r_cpp | Unsorted

Telegram-канал r_cpp - C++ - Reddit

-

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

Subscribe to a channel

C++ - Reddit

Using std::cpp Keynote: C++: The Balancing Act of Power, Compatibility, and Safety - Juan Alday
https://www.youtube.com/watch?v=jIE9UxA_wiA

https://redd.it/1kxoziz
@r_cpp

Читать полностью…

C++ - Reddit

Kourier: the fastest server for building web services is open source and written in C++/Qt
https://github.com/kourier-server/kourier

https://redd.it/1kxfx6s
@r_cpp

Читать полностью…

C++ - Reddit

gsl-lite v1.0 released

https://github.com/gsl-lite/gsl-lite
Release notes: https://github.com/gsl-lite/gsl-lite/releases

*gsl-lite* is an implementation of the C++ Core Guidelines Support Library originally based on Microsoft GSL.

Main changes in v1.0:

- gsl-lite now lives in namespace gsl_lite and no longer defines Expects() and Ensures() (use gsl_Expects(), gsl_Ensures() instead). This means gsl-lite can now coexist with Microsoft GSL.
- We borrowed the span<> implementation from Microsoft GSL which has static extents and a checked iterator.
- Sane defaults are now the default :)

We also have more documentation now.

gsl-lite v1.0.1 is available via Vcpkg, a PR to Conan Center is currently pending.

https://redd.it/1kxbbw8
@r_cpp

Читать полностью…

C++ - Reddit

variable)
            Kokkos::parallel_reduce("MaxResidual",
                Kokkos::MDRangePolicy<Kokkos::Rank<2>>({1, 1}, {NY - 1, NX - 1}),
                [=] KOKKOS_FUNCTION (const int j, const int i, double& local_maxres) { // j: y-index, i: x-index
                    double point_residual_val = Kokkos::fabs(
                        0.25 * (P_new(i + 1, j) + P_new(i - 1, j) +
                                P_new(i, j + 1) + P_new(i, j - 1)) -
                        P_new(i, j)
                    );
                   
                    if (point_residual_val > local_maxres) {
                        local_maxres = point_residual_val;
                    }
                }, Kokkos::Max<double>(maxres)); // Kokkos::Max reducer updates host variable 'maxres'
           
            Kokkos::fence("ResidualCalculationComplete");
            if (iter % 100 == 0) {
                std::cout << "Iter: " << iter << " maxres: " << maxres << std::endl;
            }
            if (maxres < TOL) {
                break; // Exit loop if converged
            }
            std::swap(phi_current_ptr, phi_next_ptr);
        }
       
        Kokkos::fence("SolverLoopComplete");
        double end_time = timer.seconds();

        std::cout << "Time taken (seconds): " << end_time << std::endl;

    }
   
    Kokkos::finalize();

    return 0;
}

The OpenMP code: Takes between 1.2-2.5 seconds on my PC with 16 OMP threads

   


#include <iostream>
    #include <cmath>
    #include <cstdlib>
    #include <ctime>
    #include <omp.h>

    #define NX (128 * 8 + 2)
    #define NY (128 * 6 + 2)
    #define MAX_ITER 10000
    #define TOL 1.0e-6
    #define DX (1.0 / (NX - 1))
    #define DY (1.0 / (NY - 1))

    int main() {
        std::cout << "Start \n";
        std::cout << "Nx="<<NX<<", NY="<<NY<<"\n";
        double phi_old[NX][NY];
        double phi_new[NX][NY];
        double residual[NX][NY];
        double maxres, diff;
        int iter, i, j;

        int num_threads = omp_get_max_threads();
        std::cout << "Using " << num_threads << " OpenMP threads\n";

        std::srand(static_cast<unsigned int>(std::time(nullptr)));
        for (j = 0; j < NY; ++j)
            for (i = 0; i < NX; ++i)
                phi_old[i][j] = static_cast<double>(std::rand()) / RAND_MAX;

        for (j = 0; j < NY; ++j)
            for (i = 0; i < NX; ++i)
                phi_new[i][j] = phi_old[i][j];

        for (i = 0; i < NX; ++i) {
            phi_old[i][0] = phi_old[i][NY - 1] = 0.0;
            phi_new[i][0] = phi_new[i][NY - 1] = 0.0;
        }
        for (j = 0; j < NY; ++j) {
            phi_old[0][j] = phi_old[NX - 1][j] = 0.0;
            phi_new[0][j] = phi_new[NX - 1][j] = 0.0;
        }

        std::cout << "Start solving...\n";
        double start_time = omp_get_wtime();

        for (iter = 1; iter <= MAX_ITER; ++iter) {
            maxres = 0.0;

            #pragma omp parallel default(shared) private(i, j)
            {
                // phi_old=phi_new. Would be more efficient to switch pointers.
                #pragma omp for schedule(static)
                for (i = 0; i < NX; ++i)
                    for (j = 0; j < NY; ++j)
                    phi_old[i][j] = phi_new[i][j];

                // Jacobi
                #pragma omp for schedule(static)
                for (i = 1; i < NX-1; ++i)
                    for (j = 1; j < NY-1; ++j)  
                        phi_new[i][j] = 0.25 * (
                            phi_old[i + 1][j] + phi_old[i - 1][j] +
                            phi_old[i][j + 1] + phi_old[i][j - 1]);

                // calculate Linf residue
               

Читать полностью…

C++ - Reddit

Kokkos vs OpenMP performance on multi-core CPUs?

Does anyone have experience on OpenMP vs Kokkos performance on multicore CPUs? I am seeing papers on its GPU performance, but when I tested Kokkos against a basic OpenMP implementation of 2D Laplace equation with Jacobi, I saw a 3-4x difference (with OpenMP being the faster one). Not sure if I am doing it right since I generated the Kokkos code using an LLM. I wanted to see if its worth it before getting into it.
The OpenMP code itself is slower than a pure MPI implementation, but from what I am reading in textbooks thats well expected. I am also seeing no difference in speed for the equivalent Fortran and C++ codes.

The Kokkos code: (generated via LLM): Takes about 6-7 seconds on my PC with 16 OMP threads

#include <iostream>
#include <cmath>   // For std::abs, std::max (Kokkos::abs used in kernel)
#include <cstdlib> // For std::rand, RANDMAX
#include <ctime>   // For std::time
#include <utility> // For std::swap

#include <KokkosCore.hpp>

#define NX (128 8 + 2) // Grid points in X direction (including boundaries)
#define NY (128 6 + 2) // Grid points in Y direction (including boundaries)
#define MAXITER 10000   // Maximum number of iterations
#define TOL 1.0e-6       // Tolerance for convergence


int main(int argc, char* argv[]) {
    // Initialize Kokkos. This should be done before any Kokkos operations.
    Kokkos::initialize(argc, argv);
    {

        std::cout << "Using Kokkos with execution space: " << Kokkos::DefaultExecutionSpace::name() << std::endl;
        Kokkos::View<double**> phi
A("phiA", NX, NY);
        Kokkos::View<double**> phi
B("phiB", NX, NY);

        // Host-side view for initialization.
        Kokkos::View<double**, Kokkos::HostSpace> phi
inithost("phiinithost", NX, NY);

        std::srand(static
cast<unsigned int>(std::time(nullptr))); // Seed random number generator
        for (int j = 0; j < NY; ++j) {
            for (int i = 0; i < NX; ++i) {
                phiinithost(i, j) = staticcast<double>(std::rand()) / RANDMAX;
            }
        }

        for (int i = 0; i < NX; ++i) { // Iterate over x-direction
            phiinithost(i, 0) = 0.0;
            phiinithost(i, NY - 1) = 0.0;
        }
        // For columns (left and right boundaries: x=0 and x=NX-1)
        for (int j = 0; j < NY; ++j) { // Iterate over y-direction
            phiinithost(0, j) = 0.0;
            phiinithost(NX - 1, j) = 0.0;
        }

        Kokkos::deepcopy(phiA, phiinithost);
        Kokkos::deepcopy(phiB, phiinithost); .
        Kokkos::fence("InitialDataCopyToDeviceComplete");

        std::cout << "Start solving with Kokkos (optimized with ping-pong buffering)..." << std::endl;
        Kokkos::Timer timer; // Kokkos timer for measuring wall clock time

        Kokkos::View<double> phi_current_ptr = &phi_A;
        Kokkos::View<double>
phinextptr = &phiB;

        int iter;
        double maxres = 0.0; // Stores the maximum residual found in an iteration

        for (iter = 1; iter <= MAX
ITER; ++iter) {
            auto& Pold = *phicurrentptr; // View to read from (previous iteration's values)
            auto& P
new = phi_next_ptr;   // View to write to (current iteration's values)
            Kokkos::parallel_for("JacobiUpdate",
                Kokkos::MDRangePolicy<Kokkos::Rank<2>>({1, 1}, {NY - 1, NX - 1}),
                // KOKKOS_FUNCTION: Marks lambda for device compilation.
                [=] KOKKOS_FUNCTION (const int j, const int i) { // j: y-index, i: x-index
                    P_new(i, j) = 0.25
(Pold(i + 1, j) + Pold(i - 1, j) +
                                          Pold(i, j + 1) + Pold(i, j - 1));
                });
            maxres = 0.0; // Reset maxres for the current iteration's reduction (host

Читать полностью…

C++ - Reddit

Address Sanitizer Updates for Visual Studio 2022 17.14
https://devblogs.microsoft.com/cppblog/address-sanitizer-updates-for-visual-studio-2022-17-14/

https://redd.it/1kwxsxe
@r_cpp

Читать полностью…

C++ - Reddit

What Is the Value of std::indirect<T>?
https://jiixyj.github.io/blog/c++/2025/05/27/value-of-std-indirect

https://redd.it/1kwpg3f
@r_cpp

Читать полностью…

C++ - Reddit

Sort me out!

I m confused where to follow or whom to follow . So I need help where I can learn C++

https://redd.it/1kwia01
@r_cpp

Читать полностью…

C++ - Reddit

How to plan a largish c++ project ?

I am starting the largest c++ project I have ever done, it is a client which talks to a server, It is difficult to plan because I don't have experience with this type of project before and I am sure I will run into unexpected problems.

I am expecting to make a manager function which managers the connection of multiple sockets, and another 3 major functions to handle send/recv to that socket. Probably all running in their own threads so recv can be blocking while the rest of the application is free to do other stuff.


Any advice to planning this type of architecture out? I only have a basic flow on paper

https://redd.it/1kwaaqz
@r_cpp

Читать полностью…

C++ - Reddit

I developed a todo GUI using only C and the Win32 API. I'm open to suggestions and contributions.

https://github.com/Efeckc17/simple-todo-c

https://redd.it/1kw6f6c
@r_cpp

Читать полностью…

C++ - Reddit

Built my first Qt desktop app: Break Time (a break reminder you can't Alt+F4 😄)

Hey folks!

Wanted to share my first real desktop app made with **Qt (C++)** — it's called **Break Time**, and its job is to make sure you don't forget to take breaks while working at your computer.

"The UI is currently in Russian, but the code is open for localization contributions!"

📌 What is Break Time?

It's a tiny desktop app where you can set your work and break intervals.

It shows timers, plays sound notifications and — my favorite feature — it won’t let you close the break window until your break is over. No Alt+F4 escape 😄.

📸 Screenshots

Main window: https://ibb.co/Vp9FmTb6

Break window: https://ibb.co/VW4X7PzX

\# 📌 Why I made this?

Like many, I often get too focused while working and forget to take breaks. Once, while studying, I spent 18 hours straight in front of my screen.

Existing apps felt too bloated or awkward to use, so I decided to build my own — simple, lightweight, and it just works.

\# 📌 Tech stack

* **Qt 6.7 (C++)**

* **QSoundEffect** for notifications

* **Qt Creator** for building & debugging

\# 📌 Features

* Set number of breaks

* Work timer

* Break timer

* Sound notifications (5 sec before break starts and ends)

* **Hard mode** — you can't close the break window manually

\# 📌 What went well

✅ Learned the Qt basics

✅ Made a functional minimal app

✅ Published my first project on **GitHub**

✅ Wrote a README, changelog and update plans

\# 📌 What I want to improve

❌ No "postpone break" or "cancel break" yet

❌ No session logs

❌ No hotkeys or autostart

Planning to add these in future updates.

\# 📌 Lessons learned

✔️ How to organize a small Qt project

✔️ Work with timers and multiple windows

✔️ Use QSoundEffect

✔️ Publish a project on GitHub

✔️ Write basic project docs

\# 📌 Plans ahead

* Add break postponing

* Log work sessions

* Hotkeys support

* Autostart option

\# 📌 Repo link

👉 [Break Time on GitHub\](https://github.com/F3lixxx/BreakTime_V2)

\# 📌 Final thoughts

Really happy I pushed this project to a working state. If you're looking for your first desktop app idea — go for something simple but useful.

Would love to hear your feedback or ideas for improvements!

**Contact:**

Telegram: [@y3nox\]()

Email: [y3nohx@gmail.com\]()

P.S. By the way, I'm currently looking for a junior C++ / Qt developer position or internship. If you know of any opportunities — would love to connect!

https://redd.it/1kvyhnw
@r_cpp

Читать полностью…

C++ - Reddit

New C++ Conference Videos Released This Month - May 2025 (Updated To Include Videos Released 2025-05-19 - 2025-05-25)

**CppCon**

2025-05-12 - 2025-05-18

* Lightning Talk: From Macro to Micro in C++ - Conor Spilsbury - [https://youtu.be/rb0EOwdTL1c](https://youtu.be/rb0EOwdTL1c)
* Lightning Talk: Amortized O(1) Complexity in C++ - Andreas Weis - [https://youtu.be/Qkz6UrWAgrU](https://youtu.be/Qkz6UrWAgrU)
* Lightning Talk: CppDefCon3 - WarGames - Kevin Carpenter - [https://youtu.be/gBCIA0Dfn7o](https://youtu.be/gBCIA0Dfn7o)

2025-05-05 - 2025-05-11

* Lightning Talk: Coding Like Your Life Depends on It: Strategies for Developing Safety-Critical Software in C++ - Emily Durie-Johnson - [https://youtu.be/VJ6HrRtrbr8](https://youtu.be/VJ6HrRtrbr8)
* Lightning Talk: Brainplus Expression Template Parser Combinator C++ Library: A User Experience - Braden Ganetsky - [https://youtu.be/msx6Ff5tdVk](https://youtu.be/msx6Ff5tdVk)
* Lightning Talk: When Computers Can't Math - Floating Point Rounding Error Explained - Elizabeth Harasymiw - [https://youtu.be/ZJKO0eoGAvM](https://youtu.be/ZJKO0eoGAvM)
* Lightning Talk: Just the Cliff Notes: A C++ Mentorship Adventure - Alexandria Hernandez Mann - [https://youtu.be/WafK6SyNx7w](https://youtu.be/WafK6SyNx7w)
* Lightning Talk: Rust Programming in 5 Minutes - Tyler Weaver - [https://youtu.be/j6UwvOD0n-A](https://youtu.be/j6UwvOD0n-A)

2025-04-28 - 2025-05-04

* Lightning Talk: Saturday Is Coming Faster - Convert year\_month\_day to Weekday Faster - Cassio Neri
* Part 1 - [https://youtu.be/64mTEXnSnZs](https://youtu.be/64mTEXnSnZs)
* Part 2 - [https://youtu.be/bnVkWEjRNeI](https://youtu.be/bnVkWEjRNeI)
* Lightning Talk: Customizing Compilation Error Messages Using C++ Concepts - Patrick Roberts - [https://youtu.be/VluTsanWuq0](https://youtu.be/VluTsanWuq0)
* Lightning Talk: How Far Should You Indent Your Code? The Number Of The Counting - Dave Steffen - [https://youtu.be/gybQtWGvupM](https://youtu.be/gybQtWGvupM)
* Chplx - Bridging Chapel and C++ for Enhanced Asynchronous Many-Task Programming - Shreyas Atre - [https://youtu.be/aOKqyt00xd8](https://youtu.be/aOKqyt00xd8)

**ADC**

2025-05-19 - 2025-05-25

* Elliptic BLEP - High-Quality Zero-Latency Anti-Aliasing - Geraint Luff - [https://youtu.be/z7k1XTrCN4s](https://youtu.be/z7k1XTrCN4s)
* Information Echoes: Introduction to Data Sonification - Rasagy Sharma - [https://youtu.be/o2fvmYZfS6U](https://youtu.be/o2fvmYZfS6U)
* Crunching the Same Numbers on Different Architectures - Analysis of the Different Architectures Used in Embedded Audio Signal Processing - Marco Del Fiasco - [https://youtu.be/Y1n6bgkjSk0](https://youtu.be/Y1n6bgkjSk0)

2025-05-12 - 2025-05-18

* Emulating the TX81Z - Techniques for Reverse Engineering Hardware Synths - Cesare Ferrari - [https://youtu.be/Ut18CPrRZeg](https://youtu.be/Ut18CPrRZeg)
* How AI Audio Apps Help Break the Communication Barrier for India's Deaf Community - Gopikrishnan S & Bharat Shetty - [https://youtu.be/aDVWOve4y9I](https://youtu.be/aDVWOve4y9I)
* Snapshot Testing for Audio DSP - A Picture’s Worth a 1000 Tests - Josip Cavar - [https://youtu.be/Y1n6bgkjSk0](https://youtu.be/Y1n6bgkjSk0)

2025-05-05 - 2025-05-11

* Introducing ni-midi2 - A Modern C++ Library Implementing MIDI2 UMP 1.1 and MIDI CI 1.2 - Franz Detro - [https://youtu.be/SUKTdUF4Gp4](https://youtu.be/SUKTdUF4Gp4)
* Advancing Music Source Separation for Indian Classical and Semi-Classical Cinema Compositions - Dr. Balamurugan Varadarajan, Pawan G & Dhayanithi Arumugam - [https://youtu.be/Y9d6CZoErNw](https://youtu.be/Y9d6CZoErNw)
* Docker for the Audio Developer - Olivier Petit - [https://youtu.be/sScbd0zBCaQ](https://youtu.be/sScbd0zBCaQ)

2025-04-28 - 2025-05-04

* Workshop: GPU-Powered Neural Audio - High-Performance Inference for Real-Time Sound Processing - Alexander Talashov & Alexander Prokopchuk - ADC 2024 - [https://youtu.be/EEKaKVqJiQ8](https://youtu.be/EEKaKVqJiQ8)
* scipy.cpp - Using AI to Port Python's scipy.signal Filter-Related Functions to C++ for Use in Real Time - Julius Smith -

Читать полностью…

C++ - Reddit

Unreal Engine C++

I am learning Unreal Engine 5 and I have a good understanding of it, but I struggle with C++ coding. It would be great if you could provide some suggestions on how to learn C++ for UE5 quickly. Additionally, please recommend both paid and free courses.

https://redd.it/1kvpk32
@r_cpp

Читать полностью…

C++ - Reddit

am i too dumb for this ?

Hey everyone,
I’m someone who recently started my coding journey and chose C++ as my first language. I’ve always enjoyed problem-solving, and I felt like C++ would be a solid foundation to build from. I've been learning through *learncpp.com*, and things were going well at first — I was consistent and understood the concepts as I went along.

But then I had to take a break for 2–3 weeks because of exams, and now I’m finding it hard to remember what I learned. I don’t mean I never understood it — I did, at the time — but now a few chapters later, it’s all a blur. Is this just part of the learning curve? Or am I doing something wrong?

To be clear, it’s not that I can’t understand the material — it’s just that I forget it pretty quickly if I don’t keep using it. I’m really interested in becoming a solid engineer and want to get better at approaching problems with the best possible solution, not just hacking something together through trial and error. I know that trial and error has its place too, but I want to improve my ability to plan and think things through before I start writing code.

If anyone has gone through the same thing or has advice on how to better retain concepts and build solid habits, I’d appreciate your input. Thanks!

https://redd.it/1kvmg00
@r_cpp

Читать полностью…

C++ - Reddit

Hey guys need some suggestions, about learning C++ , i already know java,python and just completed mern dev(building projects and getting better at auth).

So, my first language was Java. I learned it in class 9 and 10 (sophomore year) as part of my school's computer science syllabus. Back then, the school had already introduced us to DSA (linked lists, stacks, queues, hashmaps). Then I had to switch schools for high school (11th and 12th), where the syllabus required Python instead.

Now I’ve passed out, completed MERN stack dev learning, built a few projects (currently working on a big one), and I’m mainly focusing on backend development.

I’m not in university yet, but I know there are international competitions like ICPC, Meta Hacker Cup, GSoC, Codeforces, etc. I want to participate in them once I get into college. I found out that most ICPC finalists or winners use C++, so I’ve started learning it. The basic programming concepts like loops and control flow are fine — not hard at all.

The real issue is the method names. I’ve gotten good at JavaScript, and it’s like all those method names are burned into my brain. Now I’m worried that when I try to do DSA in C++, I’ll mess things up fast because I’ll mix up method names, syntax, and all that.

How do I overcome this?

https://redd.it/1kv0ww9
@r_cpp

Читать полностью…

C++ - Reddit

C/C++ console game library

Hi! I'm looking for a C/C++ library that will allow me to create a simple 2D OR 3D console game (not a text game, just a regular one, but in the terminal).

https://redd.it/1kxmqf3
@r_cpp

Читать полностью…

C++ - Reddit

I can't understand inheritnace C++ and Polyphirms guys



https://redd.it/1kxemdr
@r_cpp

Читать полностью…

C++ - Reddit

#pragma omp for reduction(max:maxres) schedule(static)
                for (i = 1; i < NX-1; ++i){
                    for (j = 1; j < NY-1; ++j){        
                    residual[i][j] = 0.25 * (
                            phi_new[i + 1][j] + phi_new[i - 1][j] +
                            phi_new[i][j + 1] + phi_new[i][j - 1]) - phi_new[i][j];
                        maxres = std::max(maxres, std::abs(residual[i][j]));
                    }
                }
            }

            if (iter % 100 == 0)
                std::cout << "Iter: " << iter << " maxres: " << maxres << "\n";

            if (maxres < TOL)
                break;
        }

        double end_time = omp_get_wtime();
        std::cout << "Time taken (seconds): " << end_time - start_time << "\n";

        return 0;
    }

https://redd.it/1kx89hx
@r_cpp

Читать полностью…

C++ - Reddit

Kokkos vs OpenMP performance on multi-core CPUs?

Does anyone have experience on OpenMP vs Kokkos performance on multicore CPUs? I am seeing papers on its GPU performance, but when I tested Kokkos against a basic OpenMP implementation of 2D Laplace equation with Jacobi, I saw a 3-4x difference (with OpenMP being the faster one). Not sure if I am doing it right since I generated the Kokkos code using an LLM. I wanted to see if its worth it before getting into it.
The OpenMP code itself is slower than a pure MPI implementation, but from what I am reading in textbooks thats well expected. I am also seeing no difference in speed for the equivalent Fortran and C++ codes.

The Kokkos code: (generated via LLM): Takes about 6-7 seconds on my PC with 16 OMP threads

#include <iostream>
#include <cmath>   // For std::abs, std::max (Kokkos::abs used in kernel)
#include <cstdlib> // For std::rand, RAND_MAX
#include <ctime>   // For std::time
#include <utility> // For std::swap

#include <Kokkos_Core.hpp>

#define NX (128 * 8 + 2) // Grid points in X direction (including boundaries)
#define NY (128 * 6 + 2) // Grid points in Y direction (including boundaries)
#define MAX_ITER 10000   // Maximum number of iterations
#define TOL 1.0e-6       // Tolerance for convergence


int main(int argc, char* argv[]) {
    // Initialize Kokkos. This should be done before any Kokkos operations.
    Kokkos::initialize(argc, argv);
    {

        std::cout << "Using Kokkos with execution space: " << Kokkos::DefaultExecutionSpace::name() << std::endl;
        Kokkos::View<double**> phi_A("phi_A", NX, NY);
        Kokkos::View<double**> phi_B("phi_B", NX, NY);

        // Host-side view for initialization.
        Kokkos::View<double**, Kokkos::HostSpace> phi_init_host("phi_init_host", NX, NY);

        std::srand(static_cast<unsigned int>(std::time(nullptr))); // Seed random number generator
        for (int j = 0; j < NY; ++j) {
            for (int i = 0; i < NX; ++i) {
                phi_init_host(i, j) = static_cast<double>(std::rand()) / RAND_MAX;
            }
        }

        for (int i = 0; i < NX; ++i) { // Iterate over x-direction
            phi_init_host(i, 0) = 0.0;
            phi_init_host(i, NY - 1) = 0.0;
        }
        // For columns (left and right boundaries: x=0 and x=NX-1)
        for (int j = 0; j < NY; ++j) { // Iterate over y-direction
            phi_init_host(0, j) = 0.0;
            phi_init_host(NX - 1, j) = 0.0;
        }

        Kokkos::deep_copy(phi_A, phi_init_host);
        Kokkos::deep_copy(phi_B, phi_init_host); .
        Kokkos::fence("InitialDataCopyToDeviceComplete");

        std::cout << "Start solving with Kokkos (optimized with ping-pong buffering)..." << std::endl;
        Kokkos::Timer timer; // Kokkos timer for measuring wall clock time

        Kokkos::View<double**>* phi_current_ptr = &phi_A;
        Kokkos::View<double**>* phi_next_ptr = &phi_B;

        int iter;
        double maxres = 0.0; // Stores the maximum residual found in an iteration

        for (iter = 1; iter <= MAX_ITER; ++iter) {
            auto& P_old = *phi_current_ptr; // View to read from (previous iteration's values)
            auto& P_new = *phi_next_ptr;   // View to write to (current iteration's values)
            Kokkos::parallel_for("JacobiUpdate",
                Kokkos::MDRangePolicy<Kokkos::Rank<2>>({1, 1}, {NY - 1, NX - 1}),
                // KOKKOS_FUNCTION: Marks lambda for device compilation.
                [=] KOKKOS_FUNCTION (const int j, const int i) { // j: y-index, i: x-index
                    P_new(i, j) = 0.25 * (P_old(i + 1, j) + P_old(i - 1, j) +
                                          P_old(i, j + 1) + P_old(i, j - 1));
                });
            maxres = 0.0; // Reset maxres for the current iteration's reduction (host

Читать полностью…

C++ - Reddit

How thorough are you with code reviews?

At the company I work for the code tends to rely on undefined behavior more often than on the actual C++ standard. There have been several times during reviews where I pointed out issues, only to be told that I might be right, but it’s not worth worrying about. This came to mind while I was looking at the thread\_queue implementation in the Paho MQTT CPP library [https://github.com/eclipse-paho/paho.mqtt.cpp/blame/master/include/mqtt/thread\_queue.h](https://github.com/eclipse-paho/paho.mqtt.cpp/blame/master/include/mqtt/thread_queue.h), where I noticed a few things:

* The constructor checks that the capacity is at least 1, but the setter doesn’t, so you can set it to 0.
* The capacity setter doesn’t notify the notFull condition variable, which could lead to a deadlock (put waits on that).
* The get function isn’t exception safe, if the copy/move constructor throws on return, the element is lost.

Where I work, the general response would be that these things would never actually happen in a real-world scenario, and looking at the repo, it has 1100 stars and apparently no one’s had an issue with it.

Am I being too nitpicky?

https://redd.it/1kx17ko
@r_cpp

Читать полностью…

C++ - Reddit

Laso Scholarship from conan.io will be provided to students of Spanish public universities in any degree of CS, Engineering or similar.
https://conan.io/laso

https://redd.it/1kwoqk2
@r_cpp

Читать полностью…

C++ - Reddit

Give me project idea guy's

It should be moderate level and interesting to do that...

https://redd.it/1kwmu22
@r_cpp

Читать полностью…

C++ - Reddit

SDL2 textures look pixelated on Windows but fine on Linux

Might be the wrong subreddit sorry. After making a simple platformer on Linux to try and learn C++ I wanted to send it to my friend who uses Windows. However after copying over the code and assets and compiling it with MSYS2 UCRT64, everything looks way more pixelated and almost degraded. The png assets are the same and I tried explicitly making every texture use SDL_ScaleModeLinear but nothing changed. Anyone experienced this and have any ideas on how to fix?



https://redd.it/1kwisz6
@r_cpp

Читать полностью…

C++ - Reddit

Committee discussing a filter_view issue

There seems to be a very lively debate happening on the SG9 ML about the nature of filter_view when being used in the context of mutations over the underlying view in the context of pipelines:

Interesting quotes:

**Herb:** Can two independent authors write two adapters/views, each verify theirs is correct in isolation, and then confidently compose them in a pipeline and know the result will still be correct?


**Nicco:** My statement is simply stating what SG9 decided. SG9 decided not to fix the broken filter view. Instead, they want anther filter view as workaround.


**Andreas:** The source of my concern here is that the complexity requirement here is not something that was introduced as part of the range proposal. It is much older, unfortunately.


**Bjarne:** I don't know of any widely accessible documentation of how views equal or exceeds the performance of loops or the use of temporaries


**Herb:** Unless we can explain which ones, in a teachable way a non-expert can follow (I haven’t seen any yet that I feel I understand well enough to follow), that's still saying "it works except when it doesn't," which is another way of saying "adapters/views are not (reliably) composable." Either verifying that each adapter/view is individually correct is sufficient to know that pipeline that composes them is also correct, or it isn’t.

-------------------

When libraries or functionalities are being proposed for the standard, for the big and important ones, other than saying here is an implementation of said library that is currently being used at big tech companies like X, Y and Z coupled with some people sitting around a table deciding on inclusion/exclusion - are there any other kinds of checks and balances, perhaps more formal, being done that would perhaps catch such issues?


Taking the the current filter_view issue as an example, if this had been brought up before the library's (ranges) inclusion, would the library authors have been required to resolve this issue before inclusion or would they have been told that it's ok to include now as it may be fixed down the road some time?

https://redd.it/1kw8ldi
@r_cpp

Читать полностью…

C++ - Reddit

Ultra Engine 0.9.9 Released

Hi, I just wanted to let you know the new version of my C++ game engine has been released: https://www.leadwerks.com/community/blogs/entry/2872-ultra-engine-099-adds-a-built-in-code-editor-mesh-reduction-tools-and-thousands-of-free-game-assets/

Based on community feedback and usability testing, the interface has undergone some revision and the built-in code editor from Leadwerks has been brought back, with a dark theme. Although Visual Studio Code is an awesome IDE, we found that it includes a lot of features people don't really need, which creates a lot of visual clutter, and a streamlined interface is easier to take in.

A built-in downloads manager provides easy access to download thousands of free game assets from our website. Manually downloading and extracting a single zip file is easy, but when you want to quickly try out dozens of items it adds a lot of overhead to the workflow, so I found that the importance of this feature cannot be overstated.

A mesh reduction tool provides a way to quickly create LODs or just turn a high-poly mesh into something usable. This is something I really discovered was needed while developing my own game, and it saves a huge amount of time not having to go between different modeling programs.

Let me know if you have any questions and I will try to answer them all. Thanks!

https://redd.it/1kw14as
@r_cpp

Читать полностью…

C++ - Reddit

[https://youtu.be/hnYuZOm0mLE](https://youtu.be/hnYuZOm0mLE)
* SRC - Sample Rate Converters in Digital Audio Processing - Theory and Practice - Christian Gilli & Michele Mirabella - [https://youtu.be/0ED32\_gSWPI](https://youtu.be/0ED32_gSWPI)

**Using std::cpp**

2025-05-19 - 2025-05-25

* Keynote: The Art of C++ Friendship - Mateusz Pusz - [https://www.youtube.com/watch?v=9J4-8veGDUA](https://www.youtube.com/watch?v=9J4-8veGDUA)
* Asynchronous C++ - Dietmar Kuhl - [https://www.youtube.com/watch?v=DTRTGbJJ0yo](https://www.youtube.com/watch?v=DTRTGbJJ0yo)

2025-05-12 - 2025-05-18

* Reflection in C++?! - MIchael Hava - [https://www.youtube.com/watch?v=LB55FfSH\_-U](https://www.youtube.com/watch?v=LB55FfSH_-U)
* Can you RVO?: Optimize your C++ Code by using Return Value Optimization - Michelle D'Souza - [https://www.youtube.com/watch?v=-qwr1BVcnkY](https://www.youtube.com/watch?v=-qwr1BVcnkY)

2025-05-05 - 2025-05-11

* C++20 Modules Support in SonarQube: How We Accidentally Became a Build System - Alejandro Álvarez - [https://www.youtube.com/watch?v=MhfUDnLge-s&amp;pp=ygUNU29uYXJRdWJlIGMrKw%3D%3D](https://www.youtube.com/watch?v=MhfUDnLge-s&amp;pp=ygUNU29uYXJRdWJlIGMrKw%3D%3D)

2025-04-28 - 2025-05-04

* Keynote: The Real Problem of C++ - Klaus Iglberger - [https://www.youtube.com/watch?v=vN0U4P4qmRY](https://www.youtube.com/watch?v=vN0U4P4qmRY)

**Pure Virtual C++**

* Getting Started with C++ in Visual Studio - [https://www.youtube.com/watch?v=W9VxRRtC\_-U](https://www.youtube.com/watch?v=W9VxRRtC_-U)
* Getting Started with Debugging C++ in Visual Studio - [https://www.youtube.com/watch?v=cdUd4e7i5-I](https://www.youtube.com/watch?v=cdUd4e7i5-I)

You can also watch a stream of the Pure Virtual C++ event here [https://www.youtube.com/watch?v=H8nGW3GY868](https://www.youtube.com/watch?v=H8nGW3GY868)

**C++ Under The Sea**

2025-05-12 - 2025-05-18

* BRYCE ADELSTEIN LELBACH - The C++ Execution Model - [https://www.youtube.com/watch?v=XBiYz7LJ3iQ](https://www.youtube.com/watch?v=XBiYz7LJ3iQ)

2025-04-28 - 2025-05-04

* CONOR HOEKSTRA - Arrays, Fusion, CPU vs GPU - [https://www.youtube.com/watch?v=q5FmkSEDA2M](https://www.youtube.com/watch?v=q5FmkSEDA2M)

https://redd.it/1kvx5ds
@r_cpp

Читать полностью…

C++ - Reddit

looking for coding courses and abit advise on what should I start with

I have finished my 12th and now I am looking for a college in the mean time i also wanna start learning about coding please help me with it

https://redd.it/1kvtavu
@r_cpp

Читать полностью…

C++ - Reddit

What DB to use?

So we need a light weight db which can be used by two processes parallely.
We started with sqlite3 but it can support only one process max.

Currently how we are doing is we have created a third service called db-service which will be holding the DB, and it will be taking db read/write requests from other two processes using IPC.

I want to get rid of that third DB service. We need a lightweight DB.

https://redd.it/1kvoupa
@r_cpp

Читать полностью…

C++ - Reddit

Is Drogon framework a good choice for production level API and web backend?

Link: https://github.com/drogonframework/drogon

Similar questions have been asked on this sub before, but since the project has now become so popular(\~12.5k stars), I want to know if it's robust enough to build for production level API and web backend. I am learning but still nascent. I would appreciate if folks could point out its pros and cons from a production prespective.

Thanks.

https://redd.it/1kvhnh2
@r_cpp

Читать полностью…

C++ - Reddit

converting any 8 digit binary number to ascii with few instructions ( max 4mul , min of none )


https://github.com/Mjz86/String/blob/main/uint_conv.md




https://redd.it/1kv18ki
@r_cpp

Читать полностью…
Subscribe to a channel