Dmitrii Kovanikov (@ChShersh) header
Dmitrii Kovanikov (@ChShersh) profile picture

Dysfunctional Programming account #1. Senior SWE. I still write C++ for money. ex-Haskell, ex-OCaml. All opinions are my own.

London, UK
Joined October 2013
Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)Photo by Dmitrii Kovanikov (@ChShersh)
Wanna become a C++ expert? Good news, everyone! Join CodeCrafters and build your own low-latency in-memory DB. And because you endured all my shitposts, you get a generous 40% discount. I reward your loyalty. app.codecrafters.io/join?via… It's time to git gud. #ad
26
37
2
736
323,202
Dynamic Array in C++ std::vector<T>
19
7
2
499
26,685
Today I spent 20 minutes walking side by side with a complete stranger because we speedmatched. We’re best friends now.
4
2
117
4,702
He did such a great job with this introduction. I hope his boss gives him a raise.
This is how Telegram CEO Pavel Durov starts a presentation.
6
9
416
28,162
What’s the stupidest thing you had to do at your job? At one of my past jobs I had to log in into a custom system daily and put number 8.0 in a cell for today meaning I worked 8 hours.
137
19
11
1,577
55,868
Immediately after I attended a talk about CPU architecture and wiring efficient low-latency code by using hardware optimally. Chat, it might be over for me.
Today I attended a Linux kernel presentation by some of the smartest people I know. I never felt more stupid in my life.
11
7
1
425
13,338
Good news: AI can’t do my job yet. Bad news: Neither can I.
69
176
11
2,635
45,493
Today I attended a Linux kernel presentation by some of the smartest people I know. I never felt more stupid in my life.
92
93
11
3,096
119,166
I sent code for review to Opus 5.5. It found 10 improvements. I had to decline all of them. They were completely irrelevant and only making the code worse.
100
33
11
1,460
107,329
Fun fact: 67 is both the smallest and largest prime number divisible by 67
Fun fact: 2 is the only even prime number. IMO, it makes it a bit odd.
5
1
99
4,520
Man: why are essential constants e and π that? God: what Man: the base of a natural logarithm e is an irrational number 2.7182… and π is also an irrational number 3.14159… why? God: first of all, e=2 and π=3
−11062769241414341239970603495681493737981374532130995 and −11061733404916469626152098526056073213151599377977031 Caiolo–Ferroni–Hoster conjecture is false
77
168
24
7,647
402,735
I must come clean, I still think that the difference between us is obvious and the similarity is just a running joke everyone keeps repeating. Like, I clearly know who I am of those two, why is it so difficult for others.
20
85
5,975
Fun fact: 2 is the only even prime number. IMO, it makes it a bit odd.
I wonder if there’s a math theorem saying how rare are prime numbers to approximate the accuracy of this function. Would be huge if something like that was actually proven recently.
7
1
2
187
15,784
There’s actually a very simple solution to cache invalidation that works in every use case
Cache invalidation is one of those things that are either straightforward, or impossible. If you implemented a cache invalidation and thought "huh that was kinda complex, I hope it works" - you're in about to find out stage.
5
1
117
21,669
Which is replacing cache invalidation with cache expiration, immutability, and versioning.
4
75
4,204
I just now realised it explains why I love C++ Since childhood I’m used to reusing every single household item and extending its lifetime. That’s why winning even nanoseconds in C++ brings joy. I’ve been surviving my whole life on micro-optimisations.
This is such a wild mindset. I proactively cancel all services I don’t use and track my spending up to b a penny. I just don’t understand how so many people can simply throw money away.
4
1
86
4,561
I wonder if there’s a math theorem saying how rare are prime numbers to approximate the accuracy of this function. Would be huge if something like that was actually proven recently.
My O(1) Prime number checker
11
31
3
1,453
72,118
To add a bit of nuance to this post (nuance on X, ikr), there's actually a legit use for raw pointers in C++ and here's my perfect ownership and resource management system. 1. No naked new/delete 2. Owners allocate resources only through std::unique_ptr<T> 3. If you need to pass a pointer read-only, you can pass just T* as an argument. 4. You can even store raw pointers if you're confident the owner dies after you. 5. You almost never need std::shared_ptr. It's poor man's GC. Only in super niche cases like "persistent binary trees" You can easily guarantee 4 at compile-time if you only store pointers in the corresponding std::unique_ptr <T> owner (aka RAII). Returning T* from a method and hoping the user doesn't store it or dies before you is a slippery slope.
Using raw pointers in C++
17
1
1
120
9,549
AI can write better code than I can. However, it can’t explain complex topics better than me yet.
38
3
6
227
12,653