home.social

#cxx — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #cxx, aggregated by home.social.

  1. Most C++ codebases aren't getting rewritten in Rust - but that doesn't mean the two can't work together.

    At Oxidize 2026, @nicofee and Nicolas Qiu Guichard (@kdab) run a practical workshop on Rust/C++ interop using CXX: calling Rust from C++ and vice versa, integrating a Rust library into a CMake project, and pulling a C++ library into a Cargo build.

    🔗 oxidizeconf.com/sessions/rust_

    #Oxidize2026 #RustLang #CPlusPlus #Interop #CXX #SystemsProgramming

  2. Most C++ codebases aren't getting rewritten in Rust - but that doesn't mean the two can't work together.

    At Oxidize 2026, @nicofee and Nicolas Qiu Guichard (@kdab) run a practical workshop on Rust/C++ interop using CXX: calling Rust from C++ and vice versa, integrating a Rust library into a CMake project, and pulling a C++ library into a Cargo build.

    🔗 oxidizeconf.com/sessions/rust_

    #Oxidize2026 #RustLang #CPlusPlus #Interop #CXX #SystemsProgramming

  3. Most C++ codebases aren't getting rewritten in Rust - but that doesn't mean the two can't work together.

    At Oxidize 2026, @nicofee and Nicolas Qiu Guichard (@kdab) run a practical workshop on Rust/C++ interop using CXX: calling Rust from C++ and vice versa, integrating a Rust library into a CMake project, and pulling a C++ library into a Cargo build.

    🔗 oxidizeconf.com/sessions/rust_

    #Oxidize2026 #RustLang #CPlusPlus #Interop #CXX #SystemsProgramming

  4. Most C++ codebases aren't getting rewritten in Rust - but that doesn't mean the two can't work together.

    At Oxidize 2026, @nicofee and Nicolas Qiu Guichard (@kdab) run a practical workshop on Rust/C++ interop using CXX: calling Rust from C++ and vice versa, integrating a Rust library into a CMake project, and pulling a C++ library into a Cargo build.

    🔗 oxidizeconf.com/sessions/rust_

    #Oxidize2026 #RustLang #CPlusPlus #Interop #CXX #SystemsProgramming

  5. Most C++ codebases aren't getting rewritten in Rust - but that doesn't mean the two can't work together.

    At Oxidize 2026, @nicofee and Nicolas Qiu Guichard (@kdab) run a practical workshop on Rust/C++ interop using CXX: calling Rust from C++ and vice versa, integrating a Rust library into a CMake project, and pulling a C++ library into a Cargo build.

    🔗 oxidizeconf.com/sessions/rust_

    #Oxidize2026 #RustLang #CPlusPlus #Interop #CXX #SystemsProgramming

  6. Choosing between Zngur and CXX for Rust/C++ interoperability?

    This detailed comparison explores their design philosophies, container support, trait objects, async capabilities, build systems, and real-world tradeoffs. 

    Full write-up: kdab.com/weighing-up-zngur-and

    #RustLang #Zngur #CXX #Cpp #Interoperability

  7. I was fixing some #Krunner plugin to result better matches.
    Being through my use of #Emacs also #Lisp guy made me want to go trough a list like in lisp,
    with a while-let unfortunately #CXX doesn't have such a feature.
    The first other result I got was about #rust. It does awfully look like lisp from that point of view.
    Just the syntax is pretty weird seeing it from that angle.

  8. This morning, I saw an exceptional ... Kopfball.
    Admittedly, it is only stdexcept.
    #cxx #programming

  9. Great article...

    std::move doesn't move anything: A deep dive into Value Categories
    0xghost.dev/blog/std-move-deep

  10. Anyone have a recommendation for a small (ideally single-file?) C++ Markdown parser library?

    I have some Markdown files that I would love to export to various other formats, and don't want to reinvent the wheel if I don't have to. I don't need any support for HTML in Markdown.

    Basically I'd love to feed Markdown into a function and be called back for each element (header, paragraph, link etc.), kinda like SAX does for XML?

    #Cxx #cplusplus #cpp #markdown #xml

  11. Vor 10 Jahren erschütterte ein Foto die Welt: Alan Kurdi, der 2-jährige ertrunken im Mittelmeer ebenso Bruder Ghalib u. Mutter Rehanna. Große Trauer u. Empörung.
    Und die Politik bekannte: Wir müssen helfen!

    Gestern entscheidet die #BuReg, die Förderung für die zivile #Seenotrettung, 2 Mio. €, komplett zu streichen. Signal: Die Rettung von Leben ist Deutschland keinen Cent mehr wert.

    Da muss die #Nächstenliebe der #Cxx-Parteien sein. 😡

    #seaeye #MerzNichtMeinKanzler sea-eye.org/haushalt/?utm_sour

  12. Currently reading up on new C++20 concepts and I do see the advantages of the spaceship operator <=>. Saves quite a bit of operator coding.
    But what about coroutines? What are real use cases? Are there some example projects out there, where the code is more readable and maintainable?
    #cxx

  13. I want to be your next #FediHire ! I've been a programmer since 1985 (as a child), I've been an IT professional since 1995 (pulling wires and swapping cards and configuring MS Windows). I graduated from University of Arkansas Fayetteville with a BS in CS in December of 2003. A full resume is available.

    I currently require a 100% remote position. I cannot relocate from Cove, #Arkansas. I would prefer W-2 employment with a base salary of at least 130k USD/yr, plus some sort of retirement offering (401k or similar) and healthcare benefits (HDCP + HSA or similar).

    I prefer something where I can be a high-performing individual contributor: reading, writing and improving source text the majority of my day, with some time spent knowledge-sharing with other developers -- learning and teaching. I'd like to work with #Haskell, #Purescript, or #Idris as the primary source language. I've previously delivered value in Haskell, #Javascript, #SQL, #Python, #Scala, #Java, #C, and #Cxx among others. I can be productive in almost any language (no PHP, please; I promised myself never again).

  14. 🎉 Yay! We finally have reflection in C++26!

    For me, as one of the contributors, this begun around 2009 when I started playing with macro-based hand-written reflection support.

    sourceforge.net/projects/mirro

    #cplusplus #cpp #cxx

  15. Say, is there a trick in C++ to make to_string() work for any type?

    If I have

    using namespace std;

    and then just write

    to_string(foo)

    it will prefer my local namespace's to_string(MyClass) and error when given an int, instead of picking std::to_string(int) for those.

    Do I really have to add all variants of

    inline string to_string(int n) { return std::to_string(n); }

    to my namespace to be able to just say to_string(foo) for any type and make it work?

    #CPlusPlus #CPP #CXX #programming

  16. Things I wish they fixed in C/C++:

    When you init an instance variable from a parameter, you often copy-paste the name of the instance variable into the parameter. This allows you to accidentally forget editing code and generate perfectly compiling but wrong code like:

    class Foo {
    public:
    int _bar;
    Foo(int bar) : _bar(_bar) {}
    };

    accidentally initializing a variable with itself instead of the parameter. (Thank goodness we have an "unused parameter” warning)

    #CXX #CPlusPlus

  17. Anyone a master of #cxx/ #RustLang I'm having troubles linking the OpenImageIO_Utils library for some Rust bindings that I'm writing, and could use some help. Some more info here: github.com/dtolnay/cxx/issues/

  18. To my #c #cxx #cpp bubble:
    Without trying it out -- what is the value of this expression?
    uint8_t i = -1 % 128;

  19. To my #c and #cxx #cpp bubble: Why does a uint8_t get promoted to uint when doing -1 on it? Example:

    #include <stdio.h>
    #include <stdint.h>

    int main(void)
    {
    uint8_t c1 = 0;
    printf("%u\n", c-1);
    return 0;
    }

    This will print (uint8_t)(c1-1) if you don't cast: (uint8_t)(c1-1)

  20. Бьёрн Страуструп призвал стандартизировать профили C++ для безопасной работы с памятью

    https://www.opennet.ru/opennews/art.shtml?num=62821

    #c++ #cpp #cxx #stroustrup #страуструп

    ---

    Звучит очень круто

  21. Бьёрн Страуструп призвал стандартизировать профили C++ для безопасной работы с памятью

    https://www.opennet.ru/opennews/art.shtml?num=62821

    #c++ #cpp #cxx #stroustrup #страуструп

    ---

    Звучит очень круто

  22. Бьёрн Страуструп призвал стандартизировать профили C++ для безопасной работы с памятью

    https://www.opennet.ru/opennews/art.shtml?num=62821

    #c++ #cpp #cxx #stroustrup #страуструп

    ---

    Звучит очень круто

  23. Бьёрн Страуструп призвал стандартизировать профили C++ для безопасной работы с памятью

    https://www.opennet.ru/opennews/art.shtml?num=62821

    #c++ #cpp #cxx #stroustrup #страуструп

    ---

    Звучит очень круто

  24. @SandraNabbefeld
    "Schamgefühl" ... nicht im Wortschatz der #Cxx

  25. Been slowly working on a #libcosmic app. It's a presentation app for my ministry and church. I originally wrote it in #C++ and #QML, but have since rewritten part of the backend to #rust with the help of #CXX-QT. This still gave me a really tricky system and I decided to investigate rust ui libraries. Seeing #system76 develop #cosmic in rust with #iced, I decided to try it, and it's working quite nice thus far. Some rough edges, but I can't wait to see it come to fruition.

  26. Some people, when confronted with a problem in C++, think:

    "I know, I'll write a custom allocator!"

    Now they've run out of memory to have more problems. So I guess that's doublegoodplusone?

    #cxx #cpp #programming

  27. Make the best of Rust and C++ and learn how to use them together effectively to make Qt applications safer and easier to maintain.

    In this course, we'll cover:
    /Use of Cargo (Rusts build system) with #CMake
    /Accessing Rust code from C++ with #CXX (and vice-versa)
    /Defining your #QObject types in Rust with CXX-Qt

    training.kdab.com/ktd25/ #QtDev #RustLang #Cpp

  28. Make the best of Rust and C++ and learn how to use them together effectively to make Qt applications safer and easier to maintain.

    In this course, we'll cover:
    /Use of Cargo (Rusts build system) with #CMake
    /Accessing Rust code from C++ with #CXX (and vice-versa)
    /Defining your #QObject types in Rust with CXX-Qt

    training.kdab.com/ktd25/ #QtDev #RustLang #Cpp

  29. Make the best of Rust and C++ and learn how to use them together effectively to make Qt applications safer and easier to maintain.

    In this course, we'll cover:
    /Use of Cargo (Rusts build system) with #CMake
    /Accessing Rust code from C++ with #CXX (and vice-versa)
    /Defining your #QObject types in Rust with CXX-Qt

    training.kdab.com/ktd25/ #QtDev #RustLang #Cpp

  30. Make the best of Rust and C++ and learn how to use them together effectively to make Qt applications safer and easier to maintain.

    In this course, we'll cover:
    /Use of Cargo (Rusts build system) with #CMake
    /Accessing Rust code from C++ with #CXX (and vice-versa)
    /Defining your #QObject types in Rust with CXX-Qt

    training.kdab.com/ktd25/ #QtDev #RustLang #Cpp

  31. Make the best of Rust and C++ and learn how to use them together effectively to make Qt applications safer and easier to maintain.

    In this course, we'll cover:
    /Use of Cargo (Rusts build system) with
    /Accessing Rust code from C++ with (and vice-versa)
    /Defining your types in Rust with CXX-Qt

    training.kdab.com/ktd25/

  32. As the saying goes in the fandom, C++ #cpp #cxx gives you enough rope to hang yourself with. IMO the smart thing to do is to use all that rope to build a rope weapon (flails ftw!) or a rope bridge. Not to, ya know, hang yourself.

    The alternative saying is that C++ gives you the power to shoot your whole leg off. Well, why would you even *do* that? Use that power to shoot and blast whole zombies (or Rust telemarketers) off instead.

    #ProgrammingLanguages #Programming

  33. It's been a while since last public update.

    Launched a pre-release today, which mostly prepares the ground work for a more independent library (without dependency on eg.: iterator, exceptions where not needed) and some support for C++26 features.

    lambs.gulix.cl/fossil.cgi/cxxo

    #cpp #cxx #cxxomfort #SoftwareRelease

  34. CW: Оголошення обмежень після класу/структури в C++

    У C++20 зʼявились концепти й обмеження для функцій, класів/структур та інших шаблонів. Для функцій та методів вимоги можна вказувати після оголошення шаблону або після функції.

    template<typename T>
        requires ...
    T f() {}
    
    template<typename T>
    T f() requires ... {}
    

    Якщо не шаблонний метод у шаблоні класу потребує додаткових вимог їх можна вказати після оголошення методу.

    template<typename T>
    class S {
        T f() requires integer<T> {}
    };
    

    У такому випадку клас може згенеруватись з будь-яким типом, але це метод буде присутній тільки якщо шаблонний тип відповідає вимогам.

    Але іноді може знадобитись використати поточний клас у вимогах. Наприклад при CRTP.

    template<typename D>
    class Base requires std::derived_from<D, Base> {...};
    

    На жаль зараз такого немає.

    #cpp #cxx #cpp20 #concepts #constrains #requires #class #template #struct #CRTP #proposal #програмування #шаблони #вимоги #обмеження #пропозиція

  35. CW: Оператор > або && у C++
    Унарний оператор >/&& замість move() №10

    Оскільки історично так склалось що по стандарту в C++ обʼєкти копіюються, а не переміщуються, тому іноді потрібно додатково вказувати виклик функції move при переміщенні обʼєкта для оптимізації. Але виглядає це не дуже тому було б дуже класно якби у нас був унарний оператор > який би виконував те саме що раніше згадана функція.

    int x = 123;
    int y = >x;
    
    # або при виклику функції
    f(>y);
    

    Для зручності він повинен мати пріоритет найвищий, на мою думку. І не повинен мати, ні лівої, ні правої асоціативності, щоб не можна було робити кілька викликів одночасно.

    Жаль що у C++ не можна створювати свої оператори як у Haskell.

    Також можливо що більш логічно буде використати не оператор >, а &&. Цей варіант виглядає зрозумілішим у цьому випадку оскільки при прийманні rvalue значення позначається це саме так.

    std::string x = "...";
    f(&&x);
    

    Мінус цього варіанту в, тому що його легше переплутати з оператором отримання адресу (&).

    Реалізація такого оператора може виглядати так:

    #include <type_traits>
    
    template <typename T>
    std::remove_reference_t<T>&& operator>(T&& x) {
        return static_cast<std::remove_reference_t<T>&&>(x);
    }
    

    Реалізація оператора && не відрізнялася нічим крім назви.

    #cpp #cxx #operators #proposal #move #rvalue #values #оператори #переміщення #програмування

  36. Ну чому noexcept не входить до підпису функції?. Було б дуже зручно робити отак:

    #include <iostream>
    
    void f() {
        std::cout << "Except\n";
    }
    
    void f() noexcept {
        std::cout << "No Except\n";
    }
    
    void g() noexcept {
        f();
    }
    
    int main() {
        f();
        g();
    }
    

    Але на жаль зараз отримую тільки це:

    noexcept_reload.cpp:7:6: помилка: перевизначення «void f()»
        7 | void f() noexcept {
          |      ^
    noexcept_reload.cpp:3:6: примітка: «void f()» раніше визначено тут
        3 | void f() {
          |
    

    блін.

    #cpp #cxx #noexcept #exceptions #reload #functions #функції #виключення #програмування #перевантаження

  37. CW: ,

    Правильна відповідь 3. Цей оператор повертає останній операнд оскільки він має ліву асоціативність, а через найнижчий пріоритет (17) його операнди потрібно обгортати в дужки для підвищення пріоритету.

    За допомогою цього ми можемо іноді ламати строгу типізацію. Наприклад його іноді застосовують у decltype для перевірки шаблонного типу до стандарту C++ 20 оскільки у цьому стандарті зʼявився кращий, спеціально для цього призначений механізм під назвою Constrains.

    auto f(auto x) -> decltype(x+1, x) {...}
    

    Це дуже простенький варіант і він може не відображати цю можливість у повній потужності й незрозумілості водночас.

    Також я знайшов такий варіант застосування.

    struct A {...};
    
    struct B : A {
        B(int x) : A( x%2==0 ? x/2 : (throw Exception(...), 0) ) {...}
    };
    

    У цьому прикладі нам потрібно зробити додаткову перевірку перед викликом конструктора базового класу, але зробити це у тілі конструктора нащадка можна тільки після виконання базового класу, тому ми робимо це у тернарному операторі й використовуємо оператор коми оскільки обидва вирази тернарного оператора повинні повертати результат одного типу.

    У C це оператор також присутній і працює так само.

    #include <stdio.h>
    
    int main() {
        printf("%d\n", (5,4,3,2,1,0));
        
        return 0;
    }
    

    Виконання цього коду виведе на екран 0.

    #c #cpp #cxx #operators #оператори #оператор #програмування

  38. CW: ,

    Правильна відповідь 3. Цей оператор повертає останній операнд оскільки він має ліву асоціативність, а через найнижчий пріоритет (17) його операнди потрібно обгортати в дужки для підвищення пріоритету.

    За допомогою цього ми можемо іноді ламати строгу типізацію. Наприклад його іноді застосовують у decltype для перевірки шаблонного типу до стандарту C++ 20 оскільки у цьому стандарті зʼявився кращий, спеціально для цього призначений механізм під назвою Constrains.

    auto f(auto x) -> decltype(x+1, x) {...}
    

    Це дуже простенький варіант і він може не відображати цю можливість у повній потужності й незрозумілості водночас.

    Також я знайшов такий варіант застосування.

    struct A {...};
    
    struct B : A {
        B(int x) : A( x%2==0 ? x/2 : (throw Exception(...), 0) ) {...}
    };
    

    У цьому прикладі нам потрібно зробити додаткову перевірку перед викликом конструктора базового класу, але зробити це у тілі конструктора нащадка можна тільки після виконання базового класу, тому ми робимо це у тернарному операторі й використовуємо оператор коми оскільки обидва вирази тернарного оператора повинні повертати результат одного типу.

    У C це оператор також присутній і працює так само.

    #include <stdio.h>
    
    int main() {
        printf("%d\n", (5,4,3,2,1,0));
        
        return 0;
    }
    

    Виконання цього коду виведе на екран 0.

    #c #cpp #cxx #operators #оператори #оператор #програмування

  39. C++ isn't a serious language.

    today's bullshit:

    template<typename T, typename U, U T::* Member>
    struct get_offset {
    static constexpr size_t offset = offsetof(T, Member);
    };

    struct Example {
    int x;
    };

    const size_t N = get_offset<Example, int, &Example::x>::offset;

    This doesn't compile with clang. because...

    1/2

    #cpp #clang #cxx #macros #cpreprocessor #doomed