C++ is a mess

The more i learn about C++ the less i want to learn about it.

Perfectly sound, makes sense, makes you think about scopes and memory
completely fine, just use delete
>We invented smart pointers to solve it! Use unique_ptr instead of Type*!
Okay i suppose, the name is bulky and at that point you might as well have garbage collection but i can live with it

What is this shit, it's like C++ has been slowly devolving to be more and more like Javascript over its lifetime. Is there a good way to develop C++ when following OOP or is it a shizophrenic paradigm that erodes the language one step at a time?

Other urls found in this thread:

lwn.net/Articles/249460/
cs.rit.edu/~ats/books/ooc.pdf
gist.github.com/bkaradzic/2e39896bc7d8c34e042b
twitter.com/NSFWRedditImage

Just stick with C or something like Ada or Go, unless you're getting into gamedev and stuck with a bunch of C++ engines and libraries.

I use local typedefs for long templated object types that I use a lot. The only time I use auto is for iterators in loops.

Not really, unique_ptr has no extra overhead, unlike garbage collection.

How would you declare a variable containing a lambda without it (and without runtime type erasure)? What return type would you give to a function returning a local struct? Also, writing "std::unordered_multimap::iterator" in full isn't always worth it.

Except it's not garbage collection as you think of it. You're thinking of Java and similar languages that have an entire system with a dedicated thread for tracking variable and memory usage, and free where necessary.

Smart pointers are nothing like that, they're literally just pointers that track their own scope, and when they go out of scope they free the memory associated with them and run the associated ~destruct(). It has no separate threads, no chunks of memory dedicated to tracking lifetime, and the only overhead is whatever complexity your ~destruct() involves, which is more a fault of your coding skills than C++ itself.


That isn't really an argument tho. You are literally berating C++ for offering... not enforcing... offering the ability to use the equivalent of "var" if we so desire to use it, whether it's to write a particularly complex piece of code, or because we simply don't want to copypaste shit like "std::unordered_multimap::iterator" everywhere.

I mean, are we lazy for opting to use std::vector instead of raw arrays?
And do you consider the language to be "devolving" because it offers us new and delete in addition to malloc and free?

C++ is what happens when you start with C and begin to glue more and more shit that isn't really compatible on top of it. Just about every two concepts in C++ clash with each other. Stay clear of this language, OP, don't listen to the tryhard 1337 h4x0rs who'll try to tell you that C++ is "real" programming. It's a massive waste of human resources that forces you to memorize tons upon tons of useless arcana if you want to use it well. Even Java is a better choice for most things despite all of its flaws.

I think the general point he is trying to make is that C++ is poorly designed. C++ constantly adds new features to make up for previous design failures. Adding in those new features only exposes additional failures though. Even allowing all C code to be valid C++ code was a mistake in many ways.
Perls motto is "there's more than one way to do it", but that only applies to the solution. No language needs 5 ways to declare an int.

Use C and cry at night because you don't have real templates. That's the only sane choice.

I am getting into gamedev. I tried Java but no one sincere uses that language. All good libraries are in C or C++, bindings are rare, often outdated, incomplete and buggy, poorly documented and have small, dead communities.

I am talking out of my ass, i am sure these decisions have been made for good reasons and i realize that you can just not use these features at all if you want. I look for a proper way to learn "modern" or "professional" C++, an opinionated guide. Looking at everything that is theoretically possible with the language is completely overbearing. inline assembly

Reconsider your language choice if you want to develop a game, it will take ages in C++. Just about every high-level language can use C bindings through a so-called FFI (foreign function interface), use that for libraries that have no counterpart in your language and are absolutely necessary.

When in doubt, use boost!

It's like that for everyone, OP...

C++ isn't schizophrenic. You are for not understanding the historical context of why things happen in C++.

It has what SWPLs crave!

Don't want to make a game necessarily, im not results oriented, i'd use an engine if that was the goal, i just want to learn something in between the semesters.


I don't necessarily want to learn the historical context, i want to learn how C++ is done nowadays, not the syntax or the basics. Recommend something please.

This is kind of what defines a not-shit language tho. If you make a language and then discover that you should have done X better, and that a vast majority of your userbase is forced to use ugly hacks, you SHOULD change X to the better.

Only a truly shit language would go "Nope this language is perfect in every way and if you think it's not then you are at fault and should learn how to to it the RIGHT way". If you prefer it this way then you might as well go open a Bible instead of a programming book.

You don't have any room to criticize the design of C++ unless you're working on your own language, or your a lisp master.

What other language(s) have you worked with/are you contrasting C++ with?

jesus christ neck yourself

I think some people might be confusing STL with the C++ language.

Because i already know them. What i meant with that sentence is everywhere i look "teaching C++" means explaining what a pointer is and that there's twenty different types of integers, and that there's the intel and microsoft compilers, and that you have to profile for memory leaks. I know all of that, i want an opinionated take on how to go about a larger project with the language.

check out writeups, "The architecture of open source applications" is a good series

You mean this? Great first impression

Linux on C++
lwn.net/Articles/249460/

I mean Linus.
Fix'd.

that doesn't necessarily discredit it you knee-jerking reactionary retard, and I'm not even the user who recommended it nor have I heard of it.

Linus could be Sam Hyde's dad

Oh ok, lol. I mean, if you know those concepts already, and bare with me because I'm retarded, you can always rewrite (and perhaps improve) one of your own larger projects in C++, right? And just translate syntax along the way via google images and such. That would propel you to getting to the meat of C++, without trudging through beginners tutorials just to learn syntax.


At least that way you'd have your own opinion, not a lump sum of random anons on the internet.

lmao who's the reactionary here

I suppose, i hoped there was a consensus on the definitive / a solid take on modern C++ programming, some resource or book.


True, but when all i have is an off hand remark on a vietnamese cartoon blog by some user and the author's an SJW, i'll think twice before buying the book. However it looks like the book isn't written by him, every chapter has a different author. And it also looks like the book isn't about C++ at all so it doesn't really matter.

Well it's tremendously popular, and expands off of the holy C, so there's going to be a lot of conflicting opinions between utility and purity/elegance/power. If I really cared I'd listen to what experts I respect have to say about it, but I don't.

what on earth are you even trying to imply you mongloid

then pirate it

Fuck off MikeeUSA
It's "you're" you lisp-loving faggot
He doesn't need a language to contrast it with dipshit

Anyhow, for what you did attempt to refute: certainly he does need a language to contrast it with, else his criticisms would be baseless, young grasshopper.

Let me know when you've got things of substance to say, bb :*

...

cs.rit.edu/~ats/books/ooc.pdf

...

C++ is shit, and "modern" C++ is just adding more "features" to it to fill the gaps of a legacy and broken language.

But sure, it can get the job done but it is not pleasant.

C++ and PDE's are forever.

'typdef' deprecated in favor of 'using'

I did, and once again, nice evasion.

user it just has a shit ton of features thats all. Don't focus on features you don't need right now just write the code first.

You really don't need to know everything as you think about your program as long as you know where to go for information about a feature. I like online references and the C++ manual for this.

C++ is great, if you don't use 90% of the features that don't make sense and don't matter how much people tell you they use them, they're using them in shit unmantainable projects.

OOP, on of the main features of c++ is shit. While for some use cases is good, the problem that it tries to solve (shitty programmers are impossible to work with, and produce shit code) is not solved by it (shitty programmers now produce shitty code that weights even more but looks nice).

auto, Lambdas and lambdas are 'nice' but will surely be misused, producing more shitty code, either unreadable or hard to debug.

Try catch sucks. It makes no sense no matter how much they try to justify it. your Try catch block doesn't make your code more safer, but in your mind, after some stupid teacher told you that try catch makes thing safer. It doesn't.

Smart pointers are nice and stuff, but don't be scared of raw pointers. It's not hard to debug pointers, It's not hard to test them. And it's not hard to use them. And if its hard for a programmer, well, just write a lightweight wrapper of your pointer stuff for them, like kiddy object stuff so they don't whine so much. We're literally doing this and the "knowledgeable" people at our company still not noticed that our engine doesn't actually uses objects for anything but the interface that we made for them. They will not notice, after all, if they can't understand pointers they probably aren't reading your code at all either.


Read a little bit about data oriented design, and perhaps follow this gist.github.com/bkaradzic/2e39896bc7d8c34e042b

Look at how Id-software programs and you will get to know how the language works its best.

What I'm hearing is that C++ has turned itself into something truly awful in search of what Rust has right now. :^)

I love modern C++. It has very power features that can really minimize code logic. Modern C++ is very strong and I'd recommend it if you're willing to look beyond the syntax of the many features.

Get your hipster NIH garbage syntax crap outta here.

Are you experiencing std::unordered_multimap::difficulties?

Hipster alert, stick with C.

more like potential employee alert

is C++ the Jeb Bush of programming languages?

You're not gonna be able to insult your way into being the top language, C.

...

You're 20 years late, grandpa.