How the fuck does anyone fuck up this badly?

C++ is among the worst programming experiences I've ever had, the touted advantages of using it are exactly what is making it difficult to use because they are implemented so horrendously.
Why is inheritance so messed up just so you can have multiple inheritance (i.e: where's my super)? Why is the documentation unclear on basic stuff (I just want to replace an item in a list dammit)? Why does the compiler randomly decide it doesn't want to upcast? Why is it that the only way I can solve this cyclical dependency is by putting the actual method lines away from the original class, making my code difficult to read?
This language is actual trash and you should be shot if you use it.

Attached: 91a628eb17d897d1defc6882516cc5bc759166d0c735cef60df30c2ab2561dc7-b.gif (150x113, 619.72K)

Other urls found in this thread:

yosefk.com/c fqa/
en.wikipedia.org/wiki/C++20
en.cppreference.com/w/cpp/compiler_support
en.cppreference.com/w/cpp/experimental/constraints
twitter.com/NSFWRedditGif

Oh and a few other ones:
Method pointers make absolutely no sense, why can't I cast them to method pointers for other classes (seriously, you might as well resort to static methods with your own this pointer)? Why is the syntax for using them so retarded?

...

Inheritance is perfectly fine, the documentation is not a C++ problem in itself, the compiler decides nothing randomly. I take your complaint about cyclical dependencies as valid, though. That's the C burden, fortunately we might see modules, and thus the end of #include insanity in C++20.


You can always reinterpret_cast, but why would you do that? What's so retarded about std::bind?

OP, you are just bad.

C++ had to be somewhat backwards compatible to C. It was this requirement that caused many kinds of sophisticated semantics and syntax for C++ language design.

Do you absolutely have to use C++? If not, an alternative you might be interested in Ada2012. It isn't a simple language, but it's a lot saner to work with than C++.

Perhaps you're just not smart enough? Consider using Java or Python as languages that'll be easier for you to grasp.

Just use C or Java.

It's been known for a long time C++ is shit. Here's the famous FQA shitting on old C++98:
yosefk.com/c fqa/

The C++ story goes like this: once upon a time there was C and C was king, because it was pretty good for practical reasons (though it had some warts like pointers and array decay and null terminated strings that don't know their own size etc.) Then came the OOP (object oriented programming) craze which is still going strong today: the thought that if you divide your code into blobs of interdependent data and code (classes, basically a bunch of functions with a shared hidden state) which may have inheritance relationships between them THEN for magic reasons your code will be better, easier to maintain, easier to understand etc. Then some narcissistic faggot called Bjarne Stroustrup decided he's gonna make an OO language to make him popular. Of course he'd have to piggyback on the popular language of the time, which was C. So: popular C + popular OOP = popular C++. Bjarne didn't care about the fact that OOP actually requires the language underneath to be high level i.e. garbage collected (among other things, like arrays being first class citizens) all he cared about was making a popular language that weenies would quickly adopt as a replacement for C.

C++ is shit because it's basically still low-level C but with a bunch of hacks added to it (for example, adding virtual functions to a class changes its size even if you don't add new member data, that's a hack; you can overload functions but that's made possible with name mangling INCOMPATIBLE between different compilers, that's a hack) to make it seem high-level and object oriented (and OOP does more obfuscation than it does anything else) while at the same time for the sake of drawing from C's popularity a facade of backward compatibility is maintained (basically by not deprecating old leftover stuff from C that shouldn't ever be used in C++ code anymore, such as string.h, malloc+free, stdio.h etc).

My suggestion to OP: if you need to stick to C++ do yourself a favor and use C++11 at least, preferably the latest (C++17), and for God's sake avoid using the C parts that they refuse to deprecate. Look up "modern C++", it's code talk for doing things in as a non-C way as possible. Otherwise just use another language.

No, I was trying to reimplement the runtime for my programming language in C++ so I could make the transpiled code more readable and keep all the code in one area, I'm just gonna go back to doing it C, it just werks.

The issue is that the language isn't hard because the difficulty provides some advantage (e.g: more control or speed), it's hard because it's designed by retards.

The fact that the standard doesn't guarantee member function pointers can be reinterpretted like that. I'm not going to start littering my code with undefined behaviour lest it break with a GCC update or on a different architecture.

I've literally used new and had the compiler tell me it's not a pointer, C++ compilers are buggy as hell because the language spec is overcomplicated.

C++11 and later is great tbh

go back to reddit you faggot.

That's not the word I would use.


C and UNIX became popular in the 80s with RISC workstations because they could get the code for cheap. They didn't have to write an OS.

C++ is based on C because Stroustrup worked at AT&T and was stuck using C, but wanted to fix some of the parts that sucked, like strings and error handling. He couldn't really fix them because C sucks too much, but that was his intent with C++. If there were any "narcissistic faggots", they were the creators of C and UNIX who spread their code everywhere even though they knew it was bad. That is a good theory that they did it because they wanted to be popular because they certainly didn't do it because they thought it would be good for the users.

This is true, but neither did anyone else at AT&T. They could have told him not to waste so much company time on that bullshit, like they could have done with C and UNIX, but for some reason, he was allowed to turn C++ into an AT&T product and they marketed it.

It wasn't until later that C became popular and then the UNIX weenies invented some bullshit excuse for why they're stuck with C and C++. C was the language replacing other languages, like Pascal, Fortran, and Lisp.

I've always thought that if Lisp were a ball of mud, and APL a diamond, that C++ was a roll of razor wire.That comparison of Lisp and APL is due to Alan Perlis - heactually described APL as a crystal. (For those who haven'tseen the reasoning, it was Alan's comment on why everyoneseemed to be able to add to Lisp, while APL seemedremarkably stable: Adding to a crystal is very hard, becauseyou have to be consistent with all its symmetry andstructure. In general, if you add to a crystal, you get amess. On the other hand, if you add more mud to a ball ofmud, it's STILL a ball of mud.)To me, C is like a ball. Looked at from afar, it's nice andsmooth. If you come closer, though, you'll see littlecracks and crazes all through it.C++, on the other hand, is the C ball pumped full of toomuch (hot) air. The diameter has doubled, tripled, andmore. All those little cracks and crazes have now growninto gaping canyons. You wonder why the thing hasn't justexploded and blown away.BTW, Alan Perlis was at various times heard to say that(C|Unix) had set back the state of computer science by(10|15) years.

Attached: shut-up-richard.mp4 (1280x720, 611.29K)

Lispbro, can you drop ugh.pdf for me? I wiped my phone and lost it.

C++11 is good. If you wrote a lot of C you'd understand its value. The main issue with C++ is only experts have any chance of not turning a large project into a pile of shit (and if you don't agree you're not an expert), but webdev sucked up all the shitters so it's not the problem that it used to be. The average C++ guy is now highly experienced.

based

Why do you keep replying to yourself? Do you think that means you have friends?

Git gud and have some respect, OP.

Operating systems are written in C++. The code that actuates the flight surfaces on aircraft is written in C++. The software that runs robots is written in C++. It’s not because some whiny channer phaggot has issues that the language is shit.

Git gud.

That's usually Ada.

C++ now rules the skies.

Attached: Ada getting BTFO.JPG (454x339 1.42 MB, 60.54K)

Hurr durr, we sure showed those Ada guys.

Attached: wasting time.jpg (182x216, 28.83K)

False. C++ is much more safe than Ada.

Remind me to never board an F-35

You never will, don't worry.

kys namefag

Tell me more about c++20 senpai

Don't worry, your fat nigger ass will never.

en.wikipedia.org/wiki/C++20
en.cppreference.com/w/cpp/compiler_support

Oh God I see they're gonna add concepts in C++20. Yeah, write meta code that you'll have to maintain as if it was real code, just for better compiler error messages, that's a sane idea ain't it! /s

en.cppreference.com/w/cpp/experimental/constraints

Then again why am I bitching, it's established tradition in C++ that the language user plays an important role in making the language high level, by manually writing the relevant code such as assignment operators and copy constructors. So this is just more of the same old "want high level functionality? code it yourself" bullshit that makes C++ the scam that it is.

It's pretty easy to get megabytes of incomprehensible error spam from incredibly minor template misuse. The language needs a way to limit that in the more complex template libraries. Don't let me stop you being mad about change, though.

Change can be good or bad, and I see you're very optimistic. Have fun screwing up your concept definitions and instantly breaking all the code using them when you correct them.

I'm a good C++ programmer, it'll be fine.

Because it's a fucking list, not a vector?


No, it is exactly because it provides both control and speed. And lack of clarity is cost for it.

You don't need to, the language will do it for you.

...

I'm actually an old C hand and this was a shitpost.

It's not that bad, it is extremely rare to have to change a concept from my experience. They're write-once-and-forget boilerplate.

SuperclassName::currentFunctionName(args) works for all superclasses.

Well that's not the good story I was looking for

Why do cucklang devotees call it 'super' and not 'parent'? It's inheritance, you inherit from parents. Is it the thought of having children that scares them, or because they didn't have a father and MI is a painful reminder?

Pajeet my son, Java is what true shitcoders strive for.
std::replace(mylist.begin(), mylist.end(), oldvalue, newvalue);
If this isn't what you meant, then maybe you should learn to clarify your own thoughts.

One thing that's legitimately shit about method pointers is that they can't be passed to C with a void * set to this as is the standard way of doing C callbacks and invoke the C++ method without it being undefined behavior. Getting around this requires a glue layer between C libraries and C++ that costs a few extra instructions per call. Like, how did they even fuck this up?

A method is just a function that takes an object as an implicit parameter. Obviously it would not make any sense to pass it to c without some crazy closure system.

Except it isn't. That's the problem. It should have been, and that's how it's implemented in all compilers I'm aware of, but it's not defined that way, so it's undefined behavior if you do it.
But it does. The way it works today in portable code is goofy - pass a dummy function and void *this to the C callback, then have the dummy function do the this->real(). It's this shitty little stub function that exists only because the standard got autistic about not tying the hands of compiler authors.

'super' -> 'superset'
thinking of classes in terms of sets of classes, collections of classes with a common property is the best way to design systems when dealing with oop.

all classes which implement XXX interface are better understood as "the collection (superset) of classes which implement XXX interface".

if you're thinking in terms of parent class and child class then youre using inheritance badly. you sound like you're in middle school, flipped through "Head First Inheritance and How to Suck Mediocre Dick", and only ever inherit from 1 class.

except it is. this is a basic feature of c++.
that dummy function would have to be done as code generation at runtime. There is no way to get a static address to a function for a particular instance of an object without something retarded like a single threaded global variable.

Looks like you're going to learn something today, user. It's explicitly forbidden in C++.
Because you're a faggot and need to stop being one, I've written you an example. It will "work" with gcc with a warning, but fail to compile with clang.

#include struct c_data { int n;};extern "C" void c_caller(void (*callback)(void *), void *data) { callback(data);}extern "C" void c_callee(void *data) { struct c_data *c_data = (struct c_data *) data; printf("c_callee: %i\n", c_data->n);}class Cpp { public: int n; void cpp_callee() { printf("cpp_callee: %i\n", n); }};int main() { struct c_data c_data = {123}; c_caller(c_callee, &c_data); Cpp cpp; cpp.n = 321; // UB c_caller((void (*)(void *)) &Cpp::cpp_callee, &cpp);}
Result on gcc:
c_callee: 123cpp_callee: 321
Because the standard forbids this, making the C++ part portable requires a dummy function as a go-between. With some template magic they can be generated automatically but the cost will still be there at runtime.

How are you so stupid?
Oh nm, you're probably a pajeet.

Do people still get confused over this?

Clearly people who call parent classes superclasses are retarded.

Learn to read retard, my problem isn't the existence of multiple inheritance, my problem is the fact that I can't have super because of it.

Attached: 2dm3x1mkqc811.jpg (640x606, 58.86K)

lol whatever man works on clang for me. stop spreading anti cpp fud.

Attached: DUePfMyVMAE6OcK.jpg (720x837, 48.18K)

Yes, the super class you derive from will still be a superset of all classes deriving from it, pure virtual does not change this. Try again.

Low int roll.

yeah ok confirmed for 12 yo streetshitter

Bjarne Shitstreet is a retard. C++ is an insult to programming.

smarter than u tho

Tee hee

if you don't use lisp+python to do everything, you are basically a brainlet

Pure virtual

What, where's the rest of my goddamn post. Anyway, what I wrote was:
Pure virtual is an implementation specification rather than representation of logic, meant to aid the programmer. Think of it as declaring a variable that shouldn't ever change as const, technically you don't have to do that, if the rest of the implementation is sound, everything will work fine, however as people aren't perfect we restrict ourselves so that we can have analysis tools detect errors we cound possibly make.
Additionally, pure virtual doesn't mean a class doesn't contain such a method, it means that the whole class is in itself abstract, we just do it on per-method basis since it allows for partial definition of said class, again - to aid the programmer. There exists a concept of a "thing", there exist many objects that are "things", but there is no object that is purely a "thing" and nothing else.

Java is among the worst programming experiences I've ever had, the touted advantages of using it are exactly what is making it difficult to use because they are implemented so horrendously.

Why is inheritance so messed up just so you can have multiple inheritance (i.e: where's my super)? Why is the documentation unclear on basic stuff (I just want to replace an item in a list dammit)? Why does the compiler randomly decide it doesn't want to upcast? Why is it that the only way I can solve this cyclical dependency is by putting the actual method lines away from the original class, making my code difficult to read?

This language is actual trash and you should be shot if you u it.

Lol, sorry about your melanin, OP.
Maybe in your next life you will be white.

But why?

Because tons of small chips are going to require that.

Microcontrollers, son.

Attached: TtoFTUh.jpg (1920x1080, 147.46K)

you STILL have yet to understand how wrong you are.

Wow OP if you weren't so busy guzzling cock maybe you'd read the book.