Why is everything ten times more complex in C++ than it should be? - /g/ (#105733647) [Archived: 687 hours ago]

Anonymous
6/28/2025, 4:01:31 PM No.105733647
hq720
hq720
md5: e20819bf39d98304bb25dd0a45d35758🔍
Even the new language features are botched in several ways compared to other languages. It's like the community is full of masochists.

The automatic npc answer is:
>MUH BACKWARD COMPATIBILITY! REEEE!
Imo it's just a weak excuse for retarded choices. The whole language is a big tragedy of the commons and lack of comprehensive planning.
Replies: >>105733654 >>105733874 >>105734055 >>105736471 >>105737127 >>105737172 >>105737801 >>105738309 >>105739285 >>105742237 >>105742292 >>105742517 >>105742533
Anonymous
6/28/2025, 4:02:10 PM No.105733654
>>105733647 (OP)
Try APL
Replies: >>105743287
Anonymous
6/28/2025, 4:25:10 PM No.105733874
>>105733647 (OP)
>
https://pastebin.com/raw/NhENNRgu
Replies: >>105737801 >>105742389 >>105742570
Anonymous
6/28/2025, 4:43:43 PM No.105734055
>>105733647 (OP)
severe case of retardation
Anonymous
6/28/2025, 4:47:59 PM No.105734115
There are less Rust threads nowadays, and more and more complaining about C++. They're giving up and accepting their fate.
sage
6/28/2025, 6:27:03 PM No.105734954
Why do these ragebait threads never name a single specific thing? Who does nobody ever call out OP on this? It's like the entire thread is bots.
Replies: >>105736263 >>105737243
Anonymous
6/28/2025, 8:43:46 PM No.105736263
>>105734954
Header hell forexample .... forward declarations are just as painful and dumb like 30 years ago. Every strategy to minimize complexity has some major flaw because the language is designed in such a stupid way.
They created modules now what is just as bloated and painful as header fuckery but in a different way.
These things are much simpler in other languages. The C++ committee lives in a bubble.
Replies: >>105736311 >>105736461 >>105737012 >>105737197
sage
6/28/2025, 8:49:03 PM No.105736311
>>105736263
Not a C++ feature.
Replies: >>105736396
Anonymous
6/28/2025, 8:58:57 PM No.105736396
>>105736311
You are officially stupid.
https://en.cppreference.com/w/cpp/language/modules.html
Anonymous
6/28/2025, 9:05:32 PM No.105736461
>>105736263
i hate cpp, but no one cares about this shit.
Anonymous
6/28/2025, 9:07:13 PM No.105736471
>>105733647 (OP)
By keeping the constrains outside of code and moving them in to comments or documentation(if you even do that), you are only archiving an illusion of simplicity. By avoiding formalization, you are skipping the short-term chore with a permanent cognitive overhead, which at some point in future will overwhelm you and you will inevitably start making mistakes.
Replies: >>105736814
Anonymous
6/28/2025, 9:45:46 PM No.105736814
>>105736471
Comments never overwhelmed me because I don't waste my time writing them.
Code is self explanatory, to me. I am the only person who matters, nobody else asked me anything about my code, so 0 people would benefit from comments.
Replies: >>105737077 >>105739061
Anonymous
6/28/2025, 10:05:38 PM No.105737012
smug nichijou
smug nichijou
md5: 088c5a20c77e1fee34a43c02d677e16b🔍
>>105736263
skill issue
Anonymous
6/28/2025, 10:11:11 PM No.105737077
>>105736814
>Comments never overwhelmed
I am not talking about comments per se, but complexity. The complexity is unavoidable and it has to be dealt with. Both writing comments or brute memorization can be used, but given large enough scope, both will fall short to formalization.
>Code is self explanatory
It only is until it isn't. We use names, types, signatures, templates, abstractions, etc to express these invariant in the code itself so it can better explain itself and how to properly use it.
Anonymous
6/28/2025, 10:16:44 PM No.105737127
>>105733647 (OP)
The C++ committee is a demonic cult that empowers their rituals using the power derived from the suffering of millions of programmers.
Replies: >>105737187 >>105739066 >>105739129 >>105740929
Anonymous
6/28/2025, 10:21:38 PM No.105737172
rust-rock
rust-rock
md5: edb564ec04594aef7a03bcfd4020956f🔍
>>105733647 (OP)
design by comitee is the root of all evil
its babylon
it is perversion of the soul
it should be punished harsher than pedophilia is
Anonymous
6/28/2025, 10:22:53 PM No.105737187
ai-suicide
ai-suicide
md5: 1811328b4f2c86bc5c5daa910370119a🔍
>>105737127
100% this
sepples is the cult of annihilation
it is everything evil in the world, but distilled
Anonymous
6/28/2025, 10:23:44 PM No.105737197
>>105736263
I think header files are good for compiled languages. Module based languages seem less able to glue together random bits of code.

In regards to forward declaration. I am currently working on my own fork of c++. One change I want to make is to significantly loosen the forward declaration requirements. Specifically, I will delay parsing of function bodies. This will allow declaring functions within a translation unit in any order.
Replies: >>105737214 >>105739159
Anonymous
6/28/2025, 10:26:14 PM No.105737214
C-aliens
C-aliens
md5: dbfee9bd2e87fde0f5b711719371730a🔍
>>105737197
>header files painful
how???
its just the explanation for the rest of your program what goes where and how we do things
>hurr durr what about self including header files/macros
what about em?
headers are a straightforward solution to a simple problem
idk whats about headers that people could hate, honest
im open to all critique bc i cant find none
Replies: >>105737676 >>105740013 >>105740064
Anonymous
6/28/2025, 10:29:30 PM No.105737243
>>105734954
Explain std::move. I'll wait.
Replies: >>105737315 >>105737365 >>105737408 >>105739271 >>105742280
Anonymous
6/28/2025, 10:35:39 PM No.105737315
>>105737243
the easiest way to understand is you change the scope of a stack variable. say i have a pointer that contains stack variables. you can move a local variable to that pointers memory location, so it doesnt fall out of scope and u dont have to allocate heap memory. also when you compile functions under the hood it does an std::move for any variable you return. this prevents unnecessary copies.
Replies: >>105737442
Anonymous
6/28/2025, 10:40:18 PM No.105737365
>>105737243
static cast to &&, which tells compiler to use the && overloads of functions
Replies: >>105737442
Anonymous
6/28/2025, 10:44:51 PM No.105737408
>>105737243
i did a bad job explaining possibly if u have no idea what i am saying. here is a clear example.
#include <iostream>
#include <vector>

class C {
public:
std::vector<int> mem;
C() { };
~C() { };
};

void do_move(C& c)
{
std::vector<int> local = {1, 2, 3, 4};
std::cout << local.data() << "\n";
c.mem = std::move(local);
}

int main()
{
C c;
do_move(c);
std::cout << c.mem.data() << "\n";
}


without the std::move it will do a copy of the data.
Anonymous
6/28/2025, 10:47:52 PM No.105737442
>>105737315
>>105737365
wrong. std::move is just a hint to compiler to attempt to turn the l-value into r-value. If the object supports copy, compiler might choose to do a copy instead of moe.

Next question:

what is the difference between:

SomeClass(SomeType&& bla) : bla(std::move(bla)) {}

and

SomeClass(SomeType&& bla) : bla(bla) {}

Does the std::move in this example matters?
Replies: >>105737466 >>105738094 >>105739287
Anonymous
6/28/2025, 10:50:34 PM No.105737466
>>105737442
you're clueless
Replies: >>105737508
Anonymous
6/28/2025, 10:55:41 PM No.105737508
>>105737466
See. As soon as I start asking more intricate questions, your understanding crumbles. Sit down and listen: as soon as you assign r-value to a variable, it becomes an l-value. Doesn't matter that the type says &&. Therefore, the std::movie is necessary in the example above to for a move to actually be performed.
Anonymous
6/28/2025, 11:40:33 PM No.105737676
>>105737214
They suck. What other language do you have to edit a function signature in 2 places? It's the one thing that Rust does better than C.
Anonymous
6/29/2025, 12:10:45 AM No.105737801
al asks you
al asks you
md5: e5446c357a870b4cdca2f03b8668c165🔍
>>105733647 (OP)
>>105733874
>one fucking spiteful asshole literally fucked up the programming timeline for decades
Cringe, or based. Call it.
Replies: >>105742389
Anonymous
6/29/2025, 12:53:00 AM No.105738094
>>105737442
All these words when you could have just looked at how std::move is implemented to see you are wrong.
Anonymous
6/29/2025, 12:56:13 AM No.105738115
What do you think std::hardware_destructive_interference_size does?

This is just them being unable to pick a reasonable name for something.
Replies: >>105739257 >>105742646 >>105742760
Anonymous
6/29/2025, 1:21:24 AM No.105738309
>>105733647 (OP)
Because its a piece of shit from the stone age with mountains of shit slapped onto it
Anonymous
6/29/2025, 3:02:23 AM No.105739061
>>105736814
Yeah. Code should be readable without comments. The comment should be in the value/function/type names.
Anonymous
6/29/2025, 3:03:28 AM No.105739066
>>105737127
This but ironically.
Anonymous
6/29/2025, 3:10:52 AM No.105739129
>>105737127
This but unironically.
Anonymous
6/29/2025, 3:13:29 AM No.105739159
>>105737197
>This will allow declaring functions within a translation unit in any order.
Sounds good.
Replies: >>105739313
Anonymous
6/29/2025, 3:24:49 AM No.105739257
>>105738115
>std::hardware_destructive_interference_size
Holy fucking God!
Anonymous
6/29/2025, 3:26:50 AM No.105739271
>>>105737243
Cast to rvalue
Anonymous
6/29/2025, 3:29:27 AM No.105739285
1642260627948
1642260627948
md5: 026d256c7afc265f0b0df584b3dc9876🔍
>>105733647 (OP)
here is a movie of bjarne dabbing on you
Anonymous
6/29/2025, 3:29:33 AM No.105739287
>>105737442
std::launder is a compiler hint, move has actual semantic meaning
Replies: >>105740918
Anonymous
6/29/2025, 3:33:52 AM No.105739313
>>105739159
I have been working on a few other features too.

Allow the declaration of private class methods without forward declaration in the class body. This means you don't have to shit up the public interface with private methods.

Another feature which I am very proud of. Is a custom attribute for arrays. Which allows the array to be initialized with initializers of heterogeneous types. Typically used with byte arrays, this feature extracts the byte representation of any expression in the intializer list. Very useful for creating a constant byte array comprised of different struct types.

Another ancillary feature I am adding related to the a fore mentioned heterogeneous array initializer feature. Is the ability to assign names to array elements. This feature will be usable with __builint_offsetof such that you can build complex file formats at compile and have header fields in one part of the generated file format refer to the offset of other parts of the file.
Replies: >>105739326
Anonymous
6/29/2025, 3:35:49 AM No.105739326
>>105739313
it seems to me like c++ made a problem instead of solving one
Anonymous
6/29/2025, 5:10:07 AM No.105740013
>>105737214
Pointers were invented by mathfags. Eunuchs troons just copied them.
Anonymous
6/29/2025, 5:17:15 AM No.105740064
>>105737214
Its easy when you only have 3 headers in your school project.
Try to manage a project with millions of lines of code and get it compiled under 10 minutes.
Replies: >>105740794
Anonymous
6/29/2025, 7:38:14 AM No.105740794
>>105740064
It's really not that hard to use header files effectively. Stop including so many other headers in your headers. You can even avoid most forward declarations by giving your objects a private object.
Replies: >>105742512
Anonymous
6/29/2025, 8:09:21 AM No.105740918
>>105739287
move is just a cast to && and has no semantic meaning, nothing is moved, RVO is the only case where the object is *gasp* moved out from a function back into the callee's chosen memory. C++ is a joke.
Replies: >>105740941 >>105742237
Anonymous
6/29/2025, 8:10:51 AM No.105740929
>>105737127
This. Bjarne has been going off on the committee lately for destroying his life's work.
Anonymous
6/29/2025, 8:13:37 AM No.105740941
>>105740918
caller's*
Yet, unironically, it could be callee, and nobody would find it weird, because it's C++.
Anonymous
6/29/2025, 11:58:26 AM No.105742237
>>105733647 (OP)
C++ is a monkey's paw language, everything good has to be balanced out with a fuckup
>>105740918
It's not a cast to &&, it's a cast to rvalue and then an rvalue can bind to a && (an rvalue reference).
&& is a value type, rvalue is a value category
Replies: >>105742345
Anonymous
6/29/2025, 12:03:17 PM No.105742267
1751178973096815
1751178973096815
md5: e2e298fc85ebe42fcf6ef64026f8a3ed🔍
Anonymous
6/29/2025, 12:05:12 PM No.105742280
>>105737243
which one?
https://en.cppreference.com/w/cpp/algorithm/move.html
Anonymous
6/29/2025, 12:07:21 PM No.105742292
>>105733647 (OP)
https://en.cppreference.com/w/cpp/memory/gc/declare_reachable.html
Anonymous
6/29/2025, 12:19:16 PM No.105742345
>>105742237
which has nothing to do with move
Anonymous
6/29/2025, 12:30:05 PM No.105742389
1598863484575
1598863484575
md5: 7e52e87bdc6a148f832ded94993d7e35🔍
>>105733874
>>105737801
https://www.stroustrup.com/bs_faq.html#IEEE
Not telling C++ is great or anything.
Anonymous
6/29/2025, 12:50:42 PM No.105742512
>>105740794
Of course but it has a cost on performance when you cant have value members in your classes.
Anonymous
6/29/2025, 12:52:11 PM No.105742517
>>105733647 (OP)
C++ is a language strongly optimized for liars and people who go by guesswork and ignorance.
Replies: >>105742538
Anonymous
6/29/2025, 12:53:55 PM No.105742533
>>105733647 (OP)
Because you're ten times dumber than you need to be.
Anonymous
6/29/2025, 12:55:04 PM No.105742538
>>105742517
When you're know what you're doing, C++ is actually just superior incarnation of C. However, most nocoders have no idea what they're doing.
Anonymous
6/29/2025, 1:00:41 PM No.105742570
>>105733874
Hilarious but fake of course. I've heard him speak at length about C++ he'd never say these things.
Well except the rewriting Unix in C++ part I bet he'd say that.
Anonymous
6/29/2025, 1:16:24 PM No.105742646
>>105738115
I'll admit, even I didn't believe this existed.
Apparently it does.
(where hardware interference refers to cache lines)
Anonymous
6/29/2025, 1:37:30 PM No.105742760
>>105738115
Nothing, some hardware has it at 128 but C++ still claims 64
Anonymous
6/29/2025, 3:19:00 PM No.105743287
>>105733654
based