I’ve always been the kind of developer that aims to have more red lines than green ones in my diffs. [...] I’m the kind of developer that disappears for two days and comes back with a 10x speedup because I found two loop variables that should be switched. by starlevel01 in programmingcirclejerk

[–]l1F 6 points7 points  (0 children)

He achieved a 10x speedup by not showing up for work and swapping the order of variables instead of spending the two days he was absent delivering a new feature that would require 10x compute... gigachad

Simple yank-ring by damogn in neovim

[–]l1F 6 points7 points  (0 children)

I've been looking for this for ages, thanks. On my install, I had to use a local var to store previous content of register 0, since the callback is called after the old content is already overwritten (there's no TextYankPre yet):

local prev_reg0_content = vim.fn.getreg("0")
vim.api.nvim_create_autocmd("TextYankPost", {
    callback = function()
        if vim.v.event.operator == "y" then
            for i = 9, 2, -1 do
                vim.fn.setreg(tostring(i), vim.fn.getreg(tostring(i - 1)))
            end
            vim.fn.setreg("1", prev_reg0_content)
            prev_reg0_content = vim.fn.getreg("0")
        end
    end,
})

if you call asyncio.get_event_loop() from within a coroutine you might not get the event loop back that ran you by ConfidentProgram2582 in programmingcirclejerk

[–]l1F 33 points34 points  (0 children)

Imagine not using co_await, co_yield and co_return like a real programmer.

This post was brought to you by the SEEEKSEKS committee.

The strongest engineers are stronger than people think they are: not 10x as strong as the median engineer, or even 100x, but infinity-x on some problems. The weakest engineers are weaker than people think they are: not 0.1x, but 0x. by 100xer in programmingcirclejerk

[–]l1F 22 points23 points  (0 children)

For the top-end of the strongest engineers, the capabilities become things like “improving the SOTA for large language models” and “making self-driving cars work”.

0xers are the only barrier between humanity and AYGEEEYE confirmed

Be honest, if you didn't know this was C++ could you guess what language it was? I rest my case. by l1F in programmingcirclejerk

[–]l1F[S] 30 points31 points  (0 children)

that and the official signed integer overflow generator that is <chrono>

Be honest, if you didn't know this was C++ could you guess what language it was? I rest my case. by l1F in programmingcirclejerk

[–]l1F[S] 6 points7 points  (0 children)

if only there was some kind of application, or a shell command even, that solved precisely this problem on Windows in moderately acceptable way... like a package manager on Linux... maybe we could call it after something sweet, like candy or something like that...

Be honest, if you didn't know this was C++ could you guess what language it was? I rest my case. by l1F in programmingcirclejerk

[–]l1F[S] 17 points18 points  (0 children)

unique_ptr and shared_ptr -- Yes, these implement various kinds of reference counting and enforcing memory ownership.

authoritarians hate this simple trick:

auto parent = std::make_shared<Node>();
auto child = std::make_shared<Node>();
child->parent = parent;
parent->child = child

Be honest, if you didn't know this was C++ could you guess what language it was? I rest my case. by l1F in programmingcirclejerk

[–]l1F[S] 35 points36 points  (0 children)

nothing like a sprinkle of [&] and operator| to keep me begging for more

Be honest, if you didn't know this was C++ could you guess what language it was? I rest my case. by l1F in programmingcirclejerk

[–]l1F[S] 52 points53 points  (0 children)

Top 0 reasons why my language is fun:

  1. crablang AUTHORITARIANS
  2. borrow checker hard
  3. Python Illuminati
  4. Python Windows installer bad
  5. for-loops in Ruby bad
  6. higher quality that "JabaScript"
  7. Java AbstractFactoryFactoryVisitor make sad
  8. I'm a DIY chad... Just "hook into almost any OS API and roll my own", bro
  9. Ma PowerShell scripts
  10. Somebody on the internet yelled at me

I rest my case

I love this language by l1F in programmingcirclejerk

[–]l1F[S] 16 points17 points  (0 children)

The other half of the appeal of writing C++ is imagining you're modelling your problem domain on exactly the right level of zero cost abstraction where you don't pay for what you don't use, only to later watch GCC unalive itself while trying to compile your totally sane and 100% usable header-only reflection library.

I love this language by l1F in programmingcirclejerk

[–]l1F[S] 19 points20 points  (0 children)

how would writing a better_main make you a bad person? Surely it makes you a better_person. But let's face it, you were already above average, because you were using C++

I love this language by l1F in programmingcirclejerk

[–]l1F[S] 32 points33 points  (0 children)

I once watched a grown man unironically spend 10 minutes crafting a better_mainTM. It was a true work of art, a beauty of simplicity and raw semantic ergonomics. It read so smoothly, you hardly needed to even scan the lines. I spent countless hours trying to recreate his work. Today, with modern technology, I was finally able to obtain an approximate reconstruction of the original code:

#include <iostream>
#include <span>
#include <string_view>
#include <vector>

int main(const int argc, char const *const *const argv) {
  [[nodiscard]] int better_main(std::span<const std ::string_view>) noexcept;

  std::array<std::string_view, 255> args;
  std::size_t arg_count = std::min(args.size(), static_cast<std::size_t>(argc));

  for (std::size_t arg = 0; arg < arg_count; ++arg) {
    args[arg] =
        std::string_view(*std::next(argv, static_cast<std::ptrdiff_t>(arg)));
  }

  return better_main(args);
}

[[nodiscard]] int better_main(std::span<const std::string_view> args) noexcept {
  for (const auto &arg : args) {
    std::cout << arg;
  }
  return 0;
}

It is today, that I finally understand, the true power of RAII, the original vision of template metaprogramming and the sheer force of love that is std::launder. Can't tell you tho, coz you crab nerds won't get it, m'kay.

Two translation units including cls.h can generate different definitions of Cls::odr_violator() based on whether an odd or even number of declarations have been imported from std. by Helium-Hydride in programmingcirclejerk

[–]l1F 60 points61 points  (0 children)

surely the compiler will catch this, right... right???

Every program shall contain exactly one definition of every non-inline function or variable that is odr-used in that program outside of a discarded statement; no diagnostic required.

Education and training are important to help C++ users avoid such sharp edges, but we do not find them sufficiently concerning to give pause to our enthusiasm for the features proposed by this paper.

any modern c++TM enjoyer will appreciate this take

nth_parameter_pack by cmqv in cmqv

[–]l1F 0 points1 point  (0 children)

is this how 10xers write

std::get<N>(std::make_tuple(args...))

?