← Home ← Back to /g/

Thread 106933508

40 posts 10 images /g/
Anonymous No.106933508 [Report] >>106933733 >>106933922 >>106934134 >>106935409 >>106935714 >>106935729 >>106935763 >>106935836 >>106936568 >>106937623 >>106937733 >>106938031 >>106938548 >>106938579 >>106939494
Why is everything in this language so fucking ugly unless its just C with classes?

I see C++ nerds even crying that people shouldnt use it with that idea in mind and the CPP people try to push these retarded new concepts that make the language even more ugly and awful to read.

This fact is the only reason why I like Rust. Rust literally cannot be ugly. It might be verbose, bloated, but CPP is that and just fucking ugly.
Anonymous No.106933522 [Report]
>why
because it needs to work.
Anonymous No.106933733 [Report] >>106935763 >>106937741
>>106933508 (OP)
classes are the worst part of C++ thoughbeit
use everything else
Anonymous No.106933922 [Report] >>106935763
>>106933508 (OP)
Everyone just slapped random new features to it for 40 years without any comprehensive goal or thinking. Yeah it's a mess. Mostly I use C# because its ten times more productive but if I have to do any low level or performance critical stuff C++ is still the least bad option.
Anonymous No.106933929 [Report]
>install classes
>muh deek is diamond inheritance
yeah the c with unnies
it about to blow your whole leg* off

* muh thrid leg (as they call the beast of my)
Anonymous No.106934134 [Report] >>106935763
>>106933508 (OP)
because c++ is just a dumping ground for retards to add as many useless "features" as they can think of. and then they insist on keeping backwards compatibility with C, so everything has to have weird syntax and all the names of everything get prefixed with underscores and shit
Anonymous No.106935409 [Report] >>106935760 >>106937713
>>106933508 (OP)
For me it's C with initialization lists and not having to type struct everywhere.
Anonymous No.106935714 [Report]
>>106933508 (OP)
>classes
For me it's C with templates
Anonymous No.106935729 [Report]
>>106933508 (OP)
it's very funny to me how two c++ experts with 30 years of experience could look at each other's codes and not have a fucking clue on how it works.
Anonymous No.106935760 [Report] >>106937713
>>106935409
>not having to type struct everywhere
typedef struct {
INT x;
INT y;
} POINT, *PPOINT;

// ...

POINT CursorLocation;
Anonymous No.106935763 [Report] >>106937635
>>106933508 (OP)
>>106933733
>>106933922
>>106934134
Anonymous No.106935765 [Report] >>106937993
Because the people leading the project made no attempt to make it aesthetically acceptable.
Anonymous No.106935836 [Report]
>>106933508 (OP)
>rust literally cannot be ugly
LMAO
Anonymous No.106936568 [Report]
>>106933508 (OP)
I'm a C++ and C# main white straight male with high bodycount.
Looking decent, even brush my teeth !
Anonymous No.106937143 [Report]
cuz
Anonymous No.106937623 [Report]
>>106933508 (OP)
>C with classes
Retarded nocoder meme. If you write Sepples as if it were C, you might as well just use C and enjoy faster compile times and better tooling.

With that said, Sepples is awful no matter how you look at it, the only people who still defend it suffer from Stockholm syndrome.
Anonymous No.106937635 [Report]
>>106935763
You have no argument. Even plain opaque types are superior to C++ classes because they enforce true compile-time encapsulation.

In C++, class definitions are commonly exposed in the header file, meaning that if you change private members, all translation uints that use that header must be recompiled.
Anonymous No.106937642 [Report] >>106937720
unemployed hands made this thread. every anti-C++ post is a neet post.
Anonymous No.106937713 [Report] >>106938260 >>106938570
>>106935409
>not having to type struct everywhere.
That's a GOOD thing.

Look at this code. Can you tell what this outputs without looking at the type definitions?
int main(void)
{
point1 p1;
point2 p2;

p1.x = 3;
p1.y = 4;
printf("%d %f\n", p1.x, p1.y);

p2.x = 3;
p2.y = 4;
printf("%d %f\n", p2.x, p2.y);
}


Solution: no. The reason is that "point1" is actually a typedef for "union point1" and "point2" typedefs "struct point2". Accessing members of a struct and a union has radically different consequences and this should be explicit in the type definition. Besides, struct and union tags don't pollute the variable namespace, which is nice.

Typedefs ONLY make sense for completely opaque types (think FILE), where client code does not and doesn't have to care what the object actually IS underneath. But anything whose members are intended to be accessed directly should never be a typedef, precisely for this reaosn.

C++ probably introduced an automatic typedef to encourage OOP, where you barely ever access members directly, but the way C++ does OOP is trash anyway so it's not worth bothering.

>>106935760
Typedef'ing non-function pointers should be a criminal offense. It buys you absolutely nothing and only obfuscates code.
Anonymous No.106937720 [Report] >>106937753
>>106937642
People much more professionally accomplished than you hate Sepples.
Anonymous No.106937733 [Report] >>106937824
>>106933508 (OP)
I agree. But
>why I like Rust
implies Rust somehow looks better, even though it's the ugliest fucking language to ever exist.
Anonymous No.106937741 [Report] >>106937937
>>106933733
Classes are the only good thing. If C++ was solely "C with classes", the language would have been immeasurably better. Maybe templates for generic data structures, but Go worked fine without them for ages.
Anonymous No.106937753 [Report] >>106937774
>>106937720
people much less brown than you have jobs
Anonymous No.106937757 [Report] >>106937775 >>106937778
>daily "retards filtered by C++" thread
Anonymous No.106937774 [Report] >>106938554
>>106937753
What language is this?
Anonymous No.106937775 [Report]
>>106937757
I am filtered actually. It's complex and doesn't have proper package/dependency management.
Anonymous No.106937778 [Report]
>>106937757
Sepples is a filter. Just not in the way you think it is.
Anonymous No.106937824 [Report]
>>106937733
show me anything ugly in rust that isnt forced and is smart code and something you would actually use
Anonymous No.106937937 [Report]
>>106937741
classes aren't bad per se, but their design is pretty dated.

for instance having constructors that can fail is a huge pain in the ass, because if you make a derived class from a class that can throw in it's constructor you end up having to deal with the weirdest shit possible.
it would become much nicer if instead of using constructors, we had something like this:
class Foo
{
static std::expected<Foo, Error> new_instance(...) { ... }
};

However doing that forbids you from using inheritance completely.

OOP in c++ only deals with dynamic dispatch. None of the other nice constructs of OOP are implemented for c++.
Anonymous No.106937969 [Report]
braindamage++
Anonymous No.106937993 [Report] >>106938175
>>106935765
>work on 10years old codebase
>started in c++11 which was new and refreshing at the time
>constexpr fuckery everywhere due to c++11 requirements that have been lifted since.
>suboptimal implementations of algorithms already in <algorithm>
>asio sockets
>boost::future and std::future mixed everywhere
>boost::promise and std::promise mixed everywhere
>somehow must still use boost because c++20 still doesn't have MPSC/SPMC or strands
>updated to c++20 but maybe 1-2 new features have been used, the codebase is still mostly c++11 idioms that now feel old

now imagine if this project started with c++98. or even worse, in early c++ some companies had their own extension set that is no longer being maintained for newer c++ versions, you can't even use standard tools like valgrind or gdb properly on them, let alone clangd or new compiler warnings.
Anonymous No.106938031 [Report]
>>106933508 (OP)
Thankfully in gamedev we're quite unapologetic about it being "C with classes".
It's an ugly language but a very practical one.
Anonymous No.106938175 [Report]
>>106937993
>asio
I like C++, but async programming in C++ is nightmarish. there's no way to do it right. literally nothing helps, even coroutines are a mess.
Anonymous No.106938260 [Report] >>106939546
>>106937713
>Can you tell what this outputs without looking at the type definitions?
Easy. Just hover over the variable and Intellisense tells you what it is.
>"point1" is actually a typedef for "union point1" and "point2" typedefs "struct point2"
That's because you're a retard and intentionally used a confusing type name because you thought you could "Gotcha" everyone. Not how it works IRL I'm afraid.
>Typedef'ing non-function pointers should be a criminal offense. It buys you absolutely nothing and only obfuscates code.
Funny, it's never been a problem for me and the entire windows codebase and the entire library of applications using the win32 API.
Of greater urgency is the need for IN, OUT and OPTIONAL annotations on function prototypes to quickly indicate to developers whether a pointer parameter is read to or written from or both. The fact that Linux code doesn't typically annotate in this way is more "criminal" if you ask me. Need to check man page for everything. On Windows I can often just call an API without ever looking at the documentation and it just werks.
Anonymous No.106938548 [Report]
>>106933508 (OP)
It's just C with tumors. It's still better than the competition since it is based on C, but it is what it is. It will never go away though.
Anonymous No.106938554 [Report]
>>106937774
"aryan" jeet. it's the first language in /g/. you should familiarize yourself with it.
sage No.106938570 [Report]
>>106937713
Sure. The signature says this function outputs an int. Simple as.

But what is this """void""" parameter you speak of though? Lol.
Anonymous No.106938579 [Report]
>>106933508 (OP)
A few years ago I became interested in template metaprogramming to the extent that all the code I produced was barely readable, let alone efficient.
While new languages may solve some of the problems in C, C++ is still to this day an infinite stack of crap maintained for the sake of retrocompatibility.
Anonymous No.106939494 [Report]
>>106933508 (OP)
>ugly
By the time most of the features were added, all the good syntax had already been taken.
Anonymous No.106939546 [Report]
>>106938260
>if you work around retarded decisions, they stop being retarded.