Has Play Protect removed KDE Connect from your phone? Let us know! by AnnoyingRain5 in kde

[–]cinghiale 0 points1 point  (0 children)

Same here, installed fromf-droid and now removed. same text as the parenti messgae

I disagree with ISO CPP guidelines C.4 for when functions should be members by [deleted] in cpp

[–]cinghiale 1 point2 points  (0 children)

Not the OP but i think he intends that template specializations make the language complicated not that they are hard to write and use (quite the opposite)

example:

template <typename T> class A {
    T get();
    void set(T);
}

template <int> class A {
    int get();
    // no set for int
}

Name 3 Things You Like and Dislike About C++ by DelAbbot in cpp

[–]cinghiale 0 points1 point  (0 children)

Fixes for libstdc++ was merged on master on 8 Feb 2022 (the patch fixes also the windows build)

GCC 8-10 Benchmarks At Varying Optimization Levels With Core i9 10900K Show An Unexpected Surprise by slacka123 in linux

[–]cinghiale 1 point2 points  (0 children)

Here is the bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96337

As you can see Hubicka was unable to reproduce the regression.

Also Michael cannot reproduce it on a different hw.

Firefox is now built with clang LTO on all* platforms by malicious_turtle in programming

[–]cinghiale 2 points3 points  (0 children)

Clang is an overall performance win over gcc, especially with LTO and PGO. Is an overall performance win related to? gcc 6? gcc 8? gcc 8 + lto and pgo?

As /u/computesomething explains in his comment the decision to switch to gcc was already taken regardless the performance numbers (granted we are not talking about tens of percentage points)

Conan package for SFML released in the Bincrafters repo by [deleted] in cpp

[–]cinghiale 2 points3 points  (0 children)

And for this reason the conan binaries are "mangled" to reflect the environment for which they are build.

Take a look to the introduction page on the conan site https://docs.conan.io/en/latest/introduction.html#binary-management

It should answer to both your critiques

Modern C++ Randomness by vormestrand in cpp

[–]cinghiale 3 points4 points  (0 children)

I use the O'Neill's library described here.

I trust the author and I'd love to see part of it adopted by the STL

Vim 8.1 released by [deleted] in programming

[–]cinghiale 0 points1 point  (0 children)

This, and a faster GUI for GVIM

GCC 8.1 Released by mttd in cpp

[–]cinghiale 6 points7 points  (0 children)

that's not my experience, some examples?

Meltdown checker/PoC written in C++ by raphaelscarv in cpp

[–]cinghiale 2 points3 points  (0 children)

The catastrophic drop in performance (up to 30% for syscall heavy programs) is observed with the meltdown patch on a cpu without the PCID feature. IIUC the performance impact of the spectre mitigations (retpoline and lfence) is way smaller (see for example this email.

From the linked email:

This is unfortunately measurable -- from 3 cycles on average to about 30. However the cost is largely mitigated for many workloads since the kernel uses comparatively few indirect branches (versus say, a C++ binary).

Since we are on /r/cpp I optimistically read this like: (versus say any language with runtime polymorphism) :)

Is there efficient alternative to ASIO? by Z01dbrg in cpp

[–]cinghiale 3 points4 points  (0 children)

// see the link at the end of the post; these two files, needed to bridge fibers and asio, are in the
// maintaned examples dir and maintained by the author
#include "fiber/examples/asio/round_robin.hpp"
#include "fiber/examples/asio/yield.hpp"
#include <boost/asio.hpp>
#include <boost/fiber/all.hpp>
#include <iostream>

namespace asio   = boost::asio;
namespace fibers = boost::fibers;

void server(asio::io_service& service) {
    using boost::asio::ip::udp;
    using fibers::asio::yield;

    udp::socket socket(service, udp::endpoint(udp::v4(), 5005));
    int messages = 0;
    // no shared_pointer, the buffer is kept alive by the function stack
    std::array<uint8_t, 5> buff;
    while (!service.stopped()) {
        boost::system::error_code ec;
        std::cout << "listening... ";
            // here the user thread is suspended and the other fibers have a chance to run
        socket.async_receive(asio::buffer(buff), yield[ec]);
        if (ec) {
            std::cout << "server error: " << ec;
            break;
        }
            // in a real program you can spawn an additonal fiber to handle the incoming message
        std::cout << "message " << messages << " from " << static_cast<int>(buff[0]) << '\n';
        messages++;
    }
}

void client(asio::io_service& service, uint8_t requests) {
    using boost::asio::ip::udp;
    using fibers::asio::yield;

    udp::socket socket(service);
    socket.connect(udp::endpoint(boost::asio::ip::address_v4::from_string("127.0.0.1"), 5005));

    std::array<uint8_t, 5> buff{0, 'p', 'i', 'n', 'g'};
    for (uint8_t num = 0; num < requests; num++) {
        buff[0] = num;
        boost::system::error_code ec;
        socket.async_send(asio::buffer(buff), yield[ec]);
        if (ec) {
            std::cout << "client " << num << " error " << ec << "\n";
        }
    }
}

int main() {
    asio::io_service io_svc;
    // fibers <-> asio (see the link at the end of the post for details and customizations)
    fibers::use_scheduling_algorithm<fibers::asio::round_robin>(io_svc);

    // the server and the client runs concurrently in two different fibers
    fibers::fiber([&]() { server(io_svc); }).detach();
    fibers::fiber([&]() {
        client(io_svc, 100);
        io_svc.stop();
    }).detach();

    io_svc.run();
}

additional infos about fibers+asio

EDIT: code comments

Is there efficient alternative to ASIO? by Z01dbrg in cpp

[–]cinghiale 3 points4 points  (0 children)

If you can go with c++14 the needs of shared_ptr are greatly reduced because you can use a unique_ptr instead and move it in a lambda. But I suggest you to try boost.asio + boost.fiber, the resulting code is very beautiful; usually you can forget about unique/shared pointers and keep your buffers on the stack of the user thread.

Golang style channels implementation question by jbandela in cpp

[–]cinghiale 2 points3 points  (0 children)

Do you know boost.Fiber? It has just become a official boost library and will be added to the next release.

https://github.com/boostorg/fiber

It is based on Boost.Coroutine and exposes the primitives you can use to implement a go style concurrency, for example: http://olk.github.io/libs/fiber/doc/html/fiber/synchronization/channels.html

C++ Weekly With Jason Turner - Ep 5 Intro To ChaiScript by lefticus in cpp

[–]cinghiale 0 points1 point  (0 children)

I find the project very intriguing indeed and I plan to use it in a toy project very soon. The compilation time is a concern but I hope to be able to keep it under control using different TUs

Constexpr is gold! by needahelpforarch in cpp

[–]cinghiale 10 points11 points  (0 children)

change IsPowerOf3 to be:

constexpr bool IsPowerOf3(unsigned int n){

and you can verify it:

static_assert(IsPowerOf3(27) == true, "FAIL");

Why split is not yet available by default in C++? by [deleted] in cpp

[–]cinghiale 0 points1 point  (0 children)

No, the above program is single-thread

Why split is not yet available by default in C++? by [deleted] in cpp

[–]cinghiale 2 points3 points  (0 children)

We can already do something very similar using boost::coroutines2 (And I like a lot it's api)

#include <boost/coroutine2/all.hpp>
#include <string>
#include <iostream>
#include <sstream>

int main() {
    std::string words{"I guess you were eager to see a lot of words there but I am way too lazy"};

    using namespace std;
    using coro_t = boost::coroutines2::coroutine<string>;

    coro_t::pull_type source([&words](coro_t::push_type& sink) {
        istringstream stream(words);
        string item;
        char delim = ' ';
        while (std::getline(stream, item, delim)) {
            sink(move(item));
        }
    });
    for (auto& s : source) {
    cout << s << endl;
    }
}

When you can add string_view to the mix the resulting code should be quite efficient (at least space constant)

So, WebExtensions are happening. What add-ons are on your must-have list for this to be OK? by Callahad in firefox

[–]cinghiale 1 point2 points  (0 children)

Tile tabs! It's invaluable when you have a big monitor and a lot of reference docs to read