#RealCode

2024-12-05

#CPlusPlus is truly a multiparadigmatic #programming language!

Pointer arithmethics, byte level data manipulation, duck typing, range loops, STL algorithms, procedural programming in something that pretends to be a class... Probably just everything in a few lines. Implicitly we even have templates as BinaryStorageBase is the non-templated base for a more complex type.

#RealCode #CodeHumor

Extract from some C++ program with colorful code highlighting. It starts with:

void Detail::BinaryStorageBase::applyByteArrayList(char *firstByte, char *lastByte, const QByteArrayList &list)

The next lines are fade out. Readable again and the important piece of code is this:

    for (auto tail = firstByte; const auto &bytes : std::as_const(list)) {
        std::copy(bytes.cbegin(), bytes.cend(), tail);
        tail += bytes.length();
    }

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst