C++ in 2017

C++ in 2017.

Discuss.

Other urls found in this thread:

freetutorials.us/the-unreal-engine-developer-course-learn-c-make-games-2/
youtube.com/watch?v=wrwwa68JXNk
youtube.com/watch?v=UTqZNujQOlA
twitter.com/SFWRedditVideos

I'm glad that I introduced Rust at work.

i'd rather use java

I just don't fucking care to deal with the autistic shitspawn that is C++ tooling.

its been deprecated by java and python. it was good while it lasted

Amazingly powerful... but not necessary 99% of the time.

std::tuple foo(int a)
{
return {a*a, a*a*a};
}

int main()
{
auto [square, triple] = foo(5);
}

Shit until c++17 made things better

What did he mean by this?

C# and Java is better unless you need to micro-optimize, but then you might as well just use C and shave a hell of a lot of bloat.

C++ is sadly one of my favourite languages. It weeds out alot of shit programmers that don't have a grasp of the basics, but every company I work for I am starting to see it's decline (and have done for years). Everything is moving towards web/cloud computing and C++ just doesn't fit the bill anymore. Unless it is a complex system that requires complex computational mathematics, complex business logic or defense. It doesn't seem to be useful anymore. Hell even Java is replacing it in those areas. I hate it, because I do love C++ and always have done but it is dying. As languages do... it will still be used don't get me wrong... it will just die eventually.

.

It's nice that they're putting some useful shit in STL these days.

Provided we get some good shit like modules by C++20, I don't see it going anywhere within the next decade at least. C++ getting killed by the latest hipster language is still a meme.

i meant employment wise, its deprecated. code monkeying has mostly shifted to Java, Python, perhaps some C#, and obviously web design will always be their. C++ ( and C as well) are essnetially artifacts of the past now

C++ hasn't really shrunk that much if at all, it's just that other languages have exploded in usage.

Java, python, javascript, etc. get the job done for a lot of things and don't require programmers to understand things like memory models, object lifetime management, etc.

> C++ hasn't really shrunk that much if at all
Yeah your right there, I probably came across in a wrong way then, I didn't mean that it is dying a death in terms of people migrating to new language, I just meant that it isn't within the list of language to use for new development.

yeah aka brainlets

>brainlets
hahahaha

cube, not triple

*trice

it's nothing but c with classes

It's not nice, but it's the only language that offers zero cost abstractions that isn't in beta like Rust.

>C++ getting killed by the latest hipster language is still a meme.

The 'histper languages' you're talking about (save for Go, which sadly is ass pushed by Google) are all far better designed than C++. Failing to recognize that C++ was always trash is a sign of a programmer with ego way bigger than talent.

>it's the only language that offers zero cost abstractions

At least mention D, which at this point has proper low profile options that allow it to be used with custom memory management and runtime. That's worth using alone for how powerful its template system is.

What's C++ still being used for?

I always associated it with trading algorithms but that might have moved to Java/Scala with all of the big data tools there now.

I'm learning C++ right now for game development in unreal engine.

Shit is hard.

Feels like it's basically used only in finance and some niche, albeit cool, industries/tech. Likely have to pair it with domain experience and/or math to really leverage the language.

I switched to rust a few months back

C++ in UE4 is easy as fuck because muh garbage collector, you don't even need STL or template

I've used it until C++11, fucking r-value references/returns are god tier.
What are newer features I should be aware of?

I haven't even really gotten that far yet.

I've been trying to implement a graph data structure.

Pointers keep fucking me up. I'm not sure how to use them properly yet.

microcontrollers, gaming industry, drivers, a shit-ton of things that actually need to work properly...

Don't bother too much with pointers, check that course: freetutorials.us/the-unreal-engine-developer-course-learn-c-make-games-2/ after some month you'll be a god at UE4 using C++

It's being "elitized".
As computers get faster, shittier, but easier to program languages take over the lower jobs, but everything is still built on top of C++ as it produces the fastest binaries.

thanks dude. Wanna hang out irl sometime?

Pointers were used for things like dynamic arrays and passing variables by reference in the original C language. C++ has things like vectors, smart pointers, and reference parameters which basically make ordinary pointers obsolete in most cases.

Accurate.
>tryhard and become proficient at C++ in university
>all extra projects use C++ where applicable
>get a job involving C++ and feel fulfilled
>odds and ends learned, get better and more efficient over time
>less than a year into said job, they start rolling out new systems
>become just another java monkey
>hunt for new jobs on the sly
>90 out of 100 in the same industry are java related
>ill never get to work with C++ again professionally
It hurts.

Java is a bad meme that can't die soon enough, fucking street shitters.

Closures and std::function. This makes a lot of stuff much much easier.

You can replace simple interfaces with structs containing std::function.

Cool, going to give it a look.

youtube.com/watch?v=wrwwa68JXNk

You're delusional if you think Java is dying.

Hey i'm 23, and learning C/C++ for using an ESP32 dev board with modules(IMU, Baro, Haptics) I'm reading code and the expressif ref guides everyday but some of the syntax is straight hyroglifics to me. How can I smooth the learning curve?

What are you finding hard about the syntax?

That's just because most of it's power comes with ridiculously unnecessary costs that other languages have avoided while being at least as powerful.

Same dude you replied to here!
I work in a new place where I use Go! The shit is good, it has its qwerks but I’m terms of relevance, it’s defiitely becoming a big thing! And yes, java is only becomin bigger because memory management isn’t something people need to worry about anymore due to the size of memory that can be given to JVMs

>Desktop applications are moving to Javascript web shit
>Embedded and enterprise moving to Java
>Languages like Go are developed entirely for babbys because C and C++ is too hard for brainlets

Right? when I was in college for my meme degree I didn't think java would be so ubiquitous. Boy was in for an awakening.

>pic related
Stuff like "#include"
Idk what or why i should be including some stuff (ie freertos/task.h)stuff.
Also the & symbol in front of words to make them "functions?"

can someone explain to me why rust is better than c++.

i have a feeling these languages changes are like shills. its a psychological phenomena in the CS/CE world. we keep changing language every time just to learn something new. because we like to learn new stuff. why cant we focus on learning things that actually will give us something back, like money.

no other industries have this problem. you cant do anything in rust that you cant do in c++.

You need to go back to the beginning and learn C.

Spend a month reading C a modern approach then go back to whatever it is you are trying to do.

* Cargo with integrated dependency handling, testing, benchmarking, etc
* Tagged unions with enums
* Match syntax
* Much simpler tuple handling
* Much simpler iterator handling
* No C legacy shit, type conversion is always explicit and giving up ownership / taking a reference to an object is always explicit
* Borrow checking
* Generics don't cause incomprehensible error messages
other things

and do you really need this. how much time does it really save. you need to include the big overhead of learning a new syntax and to use the gimmicks in a good way, for everyone working in the company.

and you know that in few months some new language will have new list of "must have things" and they have to relearn a language again. temping to at least skip every few times.

also this time is not spent on learning something useful, like some new big library or whatever.

can you really justify the time spent on this.

I'll stick to Rust.

>Tagged unions with enums
Unless I'm mistaken about what this is, we have it with std::variant.

Tuples & iterators I don't see how they could get much simpler with structured bindings now in the language.

The rest of it is valid though, I'd love to see a match syntax, the spew when using generics still isn't solved and a lot of the C legacy shit is a pain. Not for me, I'm perfectly used to it, but if you're ever trying to introduce someone to C++ or inform a colleague who's less proficient in it than you are... You end up having to explain far more than you should just to explain why putting a plus sign between two string literals isn't going to work.

If you are in the defense industry/cybersecurity it is still a relevant language.

For defensive solutions, e.g. you shouldn't write an AV engine with java, python, c# unless you are retarded. Might as well go with javascript.

For offensive solutions, e.g. again you can't screw with the kernel or use memory injections by simply using java, python and c#. Try manipulating C libraries with Python, it is boring, code obfuscation is a pain in the ass etc.

C is an overkill for both cases, C++ on the other hand is a nice middle-ground. However in red-teaming scenarios C has less overhead than C++ which means smaller file size. Other than that I wouldn't bother with it.

Cool, thanks.

>Unless I'm mistaken about what this is, we have it with std::variant.
>Tuples & iterators I don't see how they could get much simpler with structured bindings now in the language.
Only in C++17, which is even newer than Rust.
>can you really justify the time spent on this.
Yes
>and you know that in few months some new language will have new list of "must have things" and they have to relearn a language again
That is an exaggeration and the benefits here are significant.
Also, Rust is practically made to integrate into bigger, existing sepples codebases.

I can only hope that D or rust will replace C++ even in areas where C++ excels.
C++ carries way too much legacy baggage, and it still lacks trivial stuff (by 2017 standards) such as a stable ABI, a module system, fucktons of memory safety features, reflection, and more

Thank you BASED user

>hyroglifics
I feel sick

DOD extensivly uses C, partially verified. Wouldn't touch C++ even if it was the last language available. If you want safe production code, you have exactly two options: ada, c. With SPARK being on life support for the past decade, you only really have C.
Fintech runs on c++, gayming runs on c++, voip runs on c++, anything to do with networking has loads of c++.

> He needs all these fancy stuff to create meme projects

hahahahaha

I'm amazed how faggots like you want "all modern features" to unfinished toy projects

JUST TELL ME WHICH FUCKING LANGUAGES TO LEARN

mfw knowing C++ inside-out
can get a job anywhere
AMA

Write out c++17 grammar.

...

I love C++, but C++ has some shortages, especially when it comes to do simple things like map/filter/zip/padlock/reduce etc

On top of that I don't like autotools, too autistic.

Idiomatic C++ would make use of std::function instead. You are thinking C

You're wearing wrong programming socks if you have trouble with anything you mentioned.
Most c++ code in the wild is legacy so it fits.

>Idiomatic C++ would make use of std::function
Depending on the context, I would first go for type inference via decltype or auto. std::function has its uses (for example dynamically changing a function) but it's rather heavyweight.
I feel C++17 really changed many things (for the better) in regard to what idioms in C++ are, especially thanks to new template deduction rules that allow to easily make pattern-matching visitors (two lines of template to get syntactic sugar similar to OCaml's). It's probably a bigger gap than C++03 -> C++11.

There are entire industries (e.g. the process industry) where C++ dominates and will continue to do so

I work within this field and have never had any troubles finding a job

Is there a reason why C++ dominates the process industry?

C++17 is just as modern and capable as any other currently popular language, however it definitely has a learning curve. I would say it's about as hard to learn as Haskell, so you can't really use it if you're a brainlet

Sepples is the language which has too much momentum to ever really get rid of, but also so much overhead that people want to get rid of it.

>inb4 this crazy mofo replaces it
youtube.com/watch?v=UTqZNujQOlA

>C++ in 2017.
Why.

Practically all graphics engines and drivers are written in cpp

>Most c++ code in the wild is legacy so it fits.
This is right and this is honestly the biggest problem with C++.
Even if the new code you'd write would use C++17 features or something (even C++11 at the very least), other people still don't know/care about them and in schools they probably still teach pre-C++11 so the young ones will write ugly shitcode.

The ampersand gives you the location of the variable in memory. The words before the functions define what the function returns. Void means returns nothing, int means returns s number (integer). The include basically let's you put other files in your code without copy/pasting them and use the functions inside them. You should really go and grab a good C++ book, even for reference. The Sup Forums wiki has some recommendations.

If you want a job, Java or python
If you want to make gayms, C++ or C#
If you want to learn servers and stuff, JS.

I don't know, but

>Process control systems are almost invariably written in C
>Process developers want desktop applications that integrate with these systems (visual models etc. of what is happening along the production lines)

Pretty natural extension

I want to connect my c++ code to my c# program, I'm on win10
what would be the best (most elegant, most efficient) method to pass c++ data to c#?
C++/CLI
C++ Interop (Implicit PInvoke)
C++ Interop
C++ COM Interop

read more stuff about it and got confused hard

It is the language I have been using professionally for last 5 years, I don't think it is changing anytime soon

The worst thing is that the resources for learning c++ are all outdated when they get published. It hasn't even been 10 years and there is already a new standard, deprecating half of older stuff and completely changing the way to write idiomatic code.
Comparison to haskell doesn't hold, you can learn haskell from documentation published in 90s and when you look at modern code, you'd understand most of it while the parts you wouldn't understand are trivial to learn.
Try doing it in a c++ project, c++03 is completely different from c++11 as is c++11 from c++17. The books don't even try to keep up, the effective c++ book is outdated already and generally there's no resource to learn proper modern c++. Some progress has been made by Bjarne on this, but it's far from complete and it isn't really meant as a learning resource for people new to the language.
In europe they teach c++11 mostly.

If you have native C++ code, then

>compile into native DLL
>make a managed C++ DLL as wrapper
>import this DLL in your C# application

If your code is not native to begin with skip to point 2

No need for PInvoke

>every major software is being written in c++
>"lol it is thrash"
Go back to your hipster language kid

Trading algos and any latency piece of finance is almost all still written in cpp.

Lmao, what are you faggots talking about? Every few months it's something different with you idiots.

>muh Javascript

>muh C++

>muh python

>muh Java

Stick with one and stop hopping. The internet is the future.

>hurr durr why would you want to use a hammer when you can build a house with a toothpick which you already know how to use

>It's nice that they're putting some useful shit in STL these days.
They are mostly putting Boost as a standard.

threads are in. network is on the way. it is a nice direction I believe.

C++ has almost no competition for complex pieces of software with extremely low latency requirements. Rust is years away from mass adoption.

This.

As a newbie learning C++, I was frustrated when looking for books. Stroustroup's Programming with C++ is the latest one which has C++ 14 features. But it is more suited towards people who never programmed before. So I switched to C++ Primer instead, I'll just start with C++ 11. But have no idea about how to learn C++ 14/17 features.

Another aspect is that there are hardly any resources covering project structure and code base organization in general. Most programmers still pop something like "myclass.h" "myclass.cpp" and use some sort of make file to build it. Just like it is still 80's. And as a consequence everybody hate compilation time, fear full rebuilds and suffer from managing dependencies.

The best option is to have someone tutor you, like a colleague. But the issue arises, how do you know they write good c++ and what is the overlap between idiomatic c++ and good c++.
There isn't anything that saves you from compilation time in big projects. For smaller projects, single compilation unit is the best you can do if you really need it to be snappy. Extensive use of templates also increases compilation time significantly even though they claim it was mostly mitigated.
The other viable solution is to have multiple dynamic units so you can run the system all the time and live-patch it piece by piece. But messing around with function pointers and dlsym is considered ugly, not to mention debugging can be a nightmare if you don't have experience with this.
But i have yet to see a larger project that has sensible compilation time without these hacks.
Our production verification toolset, written in c and ocaml, has about 800k loc of C and it compiles so fast that i can have emacs to recompile on save. Meanwhile our experimental tool for verification of lock-free structures, a whopping 60k of c++14, compiles in over two minutes. And that isn't even the worst state it was in.

My work is switching from a mix of C/C++/Python to use Rust in the next few years.

>That is an exaggeration and the benefits here are significant.

This is really important to note, as languages with tons of better features and far fewer flaws than C++ have existed for ages. Simply moving to something with all of its power but none of its suckage is enough.

Rust has most of its suckage and most of its power whenever you look at the real world. It's great in theory (not really, there are better languages- idris for instance) but it is disappointing in real world.
For systems, you have unsafe blocks all over the place (and you spend most of cputime there too). For applications, the syntax gets even more disgusting than c++ templates in the good old days.
There isn't a reason to move from c++ to rust unless you have some atrocity from dark ages and you really really like rust. Commercial analysis tools for c++ coupled with usage of modern features (hello unique_ptr) can give you similiarly false sense of safety as rust, but more comfortably if your argument is "muh memory safety".

I have no fundamental issue with Jai other than the fact that it's a third leg that doesn't offer significant advantages that couldn't be incorporated into another existing C++ successor. If Jai 'wins' and and the next Unreal is actually written in it (which is a not insignificant possibility, given Tim Sweeney's desire to move beyond C++'s limitations and veto the need for scripting languages).

I'm not even advocating for Rust, which is much newer and really more suited for future theoretically safety critical projects.

Why isn't Jai available to the public already? If only as a preview or something.
It's like it's just jblow's private toy or something.