[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: ISO_C++_Logo.svg.png (43 KB, 800x901)
43 KB
43 KB PNG
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.
>>
>why
because it needs to work.
>>
>>106933508
classes are the worst part of C++ thoughbeit
use everything else
>>
File: 1758993979054410.jpg (54 KB, 554x554)
54 KB
54 KB JPG
>>106933508
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.
>>
>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)
>>
>>106933508
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
>>
>>106933508
For me it's C with initialization lists and not having to type struct everywhere.
>>
>>106933508
>classes
For me it's C with templates
>>
>>106933508
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.
>>
>>106935409
>not having to type struct everywhere
typedef struct {
INT x;
INT y;
} POINT, *PPOINT;

// ...

POINT CursorLocation;
>>
File: nobrain.png (4 KB, 505x572)
4 KB
4 KB PNG
>>106933508
>>106933733
>>106933922
>>106934134
>>
Because the people leading the project made no attempt to make it aesthetically acceptable.
>>
File: rust_logo.png (30 KB, 1024x1024)
30 KB
30 KB PNG
>>106933508
>rust literally cannot be ugly
LMAO
>>
File: 1743292129968721.jpg (74 KB, 530x402)
74 KB
74 KB JPG
>>106933508
I'm a C++ and C# main white straight male with high bodycount.
Looking decent, even brush my teeth !
>>
cuz
>>
>>106933508
>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.
>>
>>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.
>>
unemployed hands made this thread. every anti-C++ post is a neet post.
>>
>>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.
>>
>>106937642
People much more professionally accomplished than you hate Sepples.
>>
>>106933508
I agree. But
>why I like Rust
implies Rust somehow looks better, even though it's the ugliest fucking language to ever exist.
>>
>>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.
>>
>>106937720
people much less brown than you have jobs
>>
>daily "retards filtered by C++" thread
>>
>>106937753
What language is this?
>>
>>106937757
I am filtered actually. It's complex and doesn't have proper package/dependency management.
>>
>>106937757
Sepples is a filter. Just not in the way you think it is.
>>
>>106937733
show me anything ugly in rust that isnt forced and is smart code and something you would actually use
>>
>>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++.
>>
braindamage++



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.