/c++/ - The C++ thread

Discuss the most powerful programming language ever created.
What kinda projects are you using it on? What are you most excited about in the upcoming C++20?

Attached: 1518278016950.jpg (557x800, 193K)

modules when?

Vinnie Falco is a faggot that doesnt want to get cucked publicly so he refuses to submit Boost to Techempower benchmarks, one of u C++ cucks should do it, ty

In 2020. Not contracts though!

>create a blank window program in C#
>~40MB RAM usage
>create a blank window program in visual C++
>~10MB RAM usage
I wish I had learned it earlier

Why is C plus plus so fast?

Semantics lead to efficient machine code implementations

Because it expects you to do all the hard thinking for it.

ELI5 please

ranges when?

The meaning of C++ programming constructs is different to other programming languages in ways that allow implementations to create more efficient code.
For example, creating an object in C++ can just be done on the stack which is very efficient while most OOP languages require it to be done on a garbage collected heap.

C++ is shit

C is faster

>What kinda projects are you using it on?
Building an operating system.
>What are you most excited about in the upcoming C++20?
Don't really care about it.

It can't be faster because C++ is a superset of C. STL works faster than anything you can ever write.

will that Jow Forums client be an essential part of the OS?

Of course :)

Attached: 1553685386116.jpg (500x667, 51K)

There is a reason that C++ programmers try and shoot down all new languages, because there is nothing about C++ that translates to normal programming. You can never really learn C++ because a language built on templates can never be learned but is more akin to a plate spinning circus act. Common features in C++ like strings and vectors have to be implemented in templates because the core language has to maintain compatibility with C. C++ programmers will shy away from the word templates and try and get people to use the word generics to give the idea that C++ is a metaprogramming language. What they wont tell you is that the purpose of meta programming is to make DSLs. Even a language like Lisp which is specifically designed for metaprogramming requires a bottom up style of programming that starts from primitives and grows up into its use case. You never hear Lisp programmings brag about using packages or libraries because pulling in someone elses metaprogramming structures goes against bottom up programming. Lisp programmers will also tell you overuse of macros is a recipe for disaster. C++ programmers on the other hand brag at how much libraries they use, in fact they have to use a hermetically sealed ecosystem of libraries because introducing external libraries into C++ quickly turns into a plumbing nightmare. There are a lot of C++ programmers on Jow Forums, mostly over 40 who have wasted their entire career on C++ and are useless for anything else. They throw words around like expressiveness to give the illusion that C++ somehow provides extra capability over other languages when its really more of a case of the emperors new clothes.

You can program literally everything in C++, including operating systems, embedded, and high-performance software. Coincidentally, C++ is used for those cases as well.
Templates are better than what you can (unsafely) do in C. Generic programming and abstractions are simply outside the design scope of C. It's painfully difficult to make easy-to-read and/or easy-to-reuse code in C.

C++ only looks good when held up to C.

I’m working on a 2d game using SDL2.
As for upcoming features, I haven’t even tried c++17 yet. I wanted to try the filesystem library, but couldn’t find a compiler that uses c++17.

It's entirely up to you how C++ works. With the latest standard, you can make a library that's zero-overhead abstracted to look like python.

gcc, clang, and msvc all fully utilise c++17. Have you explicitly flagged the use of c++17?

>but couldn’t find a compiler that uses c++17
the hell are you using now then

>>Hey anons someone told me to use C++. Now i have one single Question every Programmer should be able to do it but i don't know how. Split a utf8 string in half? no external Libraries allowed only pure C++17!

>What kinda projects are you using it on?
Right now working on an Everything clone for Linux and an OpenGL GUI library.

>What are you most excited about in the upcoming C++20?
std::format so I don't have to pull fmtlib in every project and math constants, everything else seems really niche

Are you passing -std=c++17 to the compiler and -lstdc++fs to the linker?

Why is compiler support coming around so slowly? Also what do you think about the future of C++ vs Rust?

When rust gets a good built-in logic analyzer, it will mark the end of C/C++ in FLOSS. A glorious new beginning, on-the-fly code auditing without heavy syntax overhead.

>first time using Qt5
>the Core and containers actually makes simple things easy, not list STL
why isn't this shilled more often?

QtCore is so much nicer than the STL.

What's wrong with STL?

I am a humble, dumb user with only experience programming in Python and Julia.

What are the single most important changes in mindset I should have when approaching and learning C++? Should I study the basics of C first? Are there any specific practices I should adopt on GNU/Linux when programming C++ stuff, or is everything the same regardless on what platform you're on?

Attached: 1557371096666.png (369x342, 238K)

>Should I study the basics of C first?
no, there's no point

So y'all talk about C++ being great
What about D

>Why is compiler support coming around so slowly?
Because compiler programmers are retards.

>Also what do you think about the future of C++ vs Rust?
C++ is C trying to be modern. Rust is an actually-modern language.

>compiler programmers are retards
I'm just some know-nothing person on the internet, but this sort of reads like "rocket scientists are retards" from my perspective

Can Rust cover all use cases for C++? Aside from legacy code, I guess

i only program in assembly language though
why bother with some bloated shit

D as in Dead

:(

yes. before someone responds to this with FUD about the executable size, being an issue in embedded situations, it's only the debug target that produces a large file. There is virtually no reason to use C++ over Rust for any new piece of software

Attached: Screenshot_20190301_g_1_33_0_is_out_Technology_4chan.png (1066x809, 282K)

shut up discord tranny, this is a c++ thread

Why did you play right into user's description of rust criticism

>discord tranny
>inb4 the left can't meme

Attached: 1536589560029.jpg (238x212, 5K)

as if on cue

Do you hate freedom?
Do you hate fun?
Do you believe safety* is more important than productivity and developer power?
Do you believe that virtue signalling about how safe your language is is more important than writing code?
Do you not understand the difference between C and C++ and constantly conflate the two?
Then rust is for you.

In short, none of the people advocating for Rust are actual C++ developers, and most don't know what the fuck they're talking about.


*Not actual safety, mind you, rust does not provide any kind of certification, nor does it actually stop you from making mistakes, nor does it enforce safety in any of the numerous C libraries it depends on.
It provides the appearance of safety, which means a bunch of borderline-suicidal mentally ill attention whores desperate to feel superior latched on to it.

Attached: why_rust_is_shit.jpg (512x512, 37K)

>It provides the appearance of safety, which means a bunch of borderline-suicidal mentally ill attention whores desperate to feel superior latched on to it.
Why did you have to go and ruin your credibility with the Jow Forumstard remark at the end of your post

it was intentional :)

>no substance whatsoever
Anyone writing remotely important code (and whoever uses that code, see pic related) should believe that safety and security comes before virtue signalling about how "free" (whatever the fuck that's supposed to mean, given that rust gives you more flexibility with constructs from all 3 programming paradigms actually integrated properly into the language) your language is.
>also Rust is fun as hell to program in if you're not pants-on-head retarded

Attached: quote-my-right-to-swing-my-fist-ends-where-your-nose-begins-oliver-wendell-holmes-91-91-00.jpg (850x400, 42K)

It is plainly obvious - whether you like it or not - that the vast majority of people advocating for rust don't even program at all, they're just desperate for validation.
Their arguments have no substance, they make constant mistakes, they completely misunderstand what they're talking about, and sound as if they're reading bullet points off of some website shilling rust.
I don't know why they do what they do, and I sincerely doubt they're all "trannies", but none of them are right in the head.

Thank you for your hot opinions, user

Consider
and
Two posts with zero substance (hardly enough to make a mistake, though *635 manages to, who clearly have never programmed in Rust of it all and throw out the Jow Forums buzzwords of the week so they can get le based and redpilled xD upvotes (see: desperate for validation). They're just bullet points with nothing but opinions and bullshit based on other anti-rust shillposts they've read on Jow Forums, which I'm assuming are the only source of information about it that they've consulted

Attached: 1547549158969.jpg (750x563, 43K)

>safety and security
Which have nothing to do with rust, because rust does not actually provide any assurances of safety at all, merely the appearance of it.
Languages like Ada provide safety, fuck even C is safer than Rust because of the enormous suite of testing software available for it.

Of course they have no substance, you're the one trying to convince C++ developers of something.
All they're doing is shitting on you because they think you're a faggot, and with good reason.
All I've seen from rustfags is
>an incredible amount of obnoxiousness
>complete unfamiliarity with modern C++ and the details of the C++ standard
>constant conflating C and C++
>delusions of safety not grounded in reality
>language features devoted to this delusion of safety which are more of a pain in the ass than not
I have not actually seen any serious argument for rust, at all.
C++ has its problems but no C++ developer is going to use a language that's an active burden to use.

Also, that crates garbage, microdependencies are bad and create a very stupid developer culture.

at the absolute worst, Rust eliminates multiple entire classes of bugs. post some Rust code which dereferences a null pointer, causes a segfault, or overflows a buffer. I'll wait.
>C is safer than Rust because it's so unsafe an enormous amount of software had to be written to achieve [almost] the same level of safety in practice as Rust
really proving your point there, buddy.
>modern C++
literally just an attempt to replicate Rust's functionality at runtime rather than compile time, but since it's not integrated into the language well the syntax is disgusting and much more of a burden on the user than Rust. If you're seriously arguing that C++11 and on are nicer than Rust's standard features despite being slower (due to being done at runtime) and tacked on to an existing language, then it's safe to assume you've never worked with Rust.
>crates garbage
>implying it's a bad thing that Rust has a sensible and easy to use dependency system
>implying it's bad that cargo automatically provides the functionality of a fully riced Makefile so you can focus on writing code instead of wasting time (ie an active burden) setting up your build system

Again, you seem to think I, and every other C++ dev, has something to prove to you.
Its the other way around, rustfag.
>implying it's a bad thing that Rust has a sensible and easy to use dependency system
It absolutely is, look at python and javascript, easy to use dependencies, especially small ones, especially language/framework integrated ones, create stupid programmers.

>3621

Rust is faster than modern C++ (since you've decided to limit the conversation to that) and nicer/faster to work with for a variety of reasons: a build system, orthogonality of language features, the traits and generics systems are WAY cleaner and more useful than C++ templates and inheritance, easier and safer multithreading due to the borrowing system (I don't mind std::thread in c++11, but Rust's move and closure semantics are super handy here), and more freedom and expressiveness due to its many zero-cost abstractions and the constructs it borrows from functional languages.
I agree that using dependencies for simple things isn't great, but you can't deny that it increases productivity significantly, which is what you were prioritizing in your previous post

It's a mess

When I use a library for C++ in code blocks how do I know what to put in the link library in linker settings?
So far I've been able to find what I need for the specific libraries either on youtube tutorial or other online tutorial site.
If I can't find any tutorial for it, how do I know what to put?

>3 posts saying posts supporting Rust don't have any content
>Provides no content even though rustanon does

Attached: 1551246726668.png (1799x825, 263K)

you want a good example of C++ being an active burden to its users?
Look no further than

>mobile phone has 4000MB
>30MB difference
>caring about 0.75% of the total memory of a machine

This is why you low-level autists will never create anything meaningful.

>it doesn't matter that it uses 4x the ram!
anti-c++ spergs really are full of shit aren't they

>No reply after getting blown out
Classic

>but you can't deny that it increases productivity significantly

Yet the Rust fags have nothing to show for it, meanwhile hundreds of thousands of C++ developers, newbies or experts, are busy creating video games, trading systems, flight control software, embedded systems, etc.

The best argument for Rust would be to write a killer app in it, but so far it's not happening.

>being an active burden to its users
Because a newbie has trouble using a library that probably doesn't fucking even exist in Rust?
You trannies are insufferable with your shilling.

Serious answer:
forget about doing that from the IDE. Learn CMake, because that's what all C++ developers are using nowadays.
Learn how it actually works: what's a linker, what's a header, how it all fits together.

It's complicated, and it's going to take a while to understand all that, but that's the cost of learning the language used by experts. If you wanted easy you'd be programming in Python.

>don't use tools that make your life easier, continue doing the things we used to do 20 years ago so that you too can join the elites
Fuck off, boomer. You're the reason why Rust is going to overtake your outdated language.

wow, more legacy C and C++ code exists than a language which has existed for a quarter of the time? Neat
Libra, Servo, and a bunch of the Hyperledger projects qualify as killer apps imo, but again you're making a stupid argument here -- it costs time and money to port over existing codebases to a new language, but there's a reason that a lot of companies (Microsoft, Google, among others) are choosing to use Rust for their new projects.
The point is that using a library in Rust requires only a single line

thanks for making my c code run well cucks
maybe i'll use vector again this year.

Fuck off, trannie
>>>/discord/

>Cnile has no arguments
>"t-trannie..."
Like clockwork.

how does one gain these skills?

Attached: job req.png (762x69, 6K)

4*0.1% is 0.4% which is literally nothing.

Install gentoo, but unironically. Look up each app's build system, change compilation flags, modify code, etc.

0.4 does not equal 0

concepts when?

space ship operator is retarted.
Literally could have been a function in std lib.

herb tried to make fucking defmacro for C++.
metaclasses are not ok.

I think your critiquing a certain type of "boost style" C++. Std lib is hardly this kind of clusterfuck.

brainlet

not stable. Garbage collection.
Slow development. Poor portability.

It practically does. I'd have to run 5000 bloated apps to notice. And I do, 16 GB ram, running discord, slack, steam, visual studio, 8 firefox processes, etc. Runs like a dream.
>b-but I don't have 16 g-
Well then buy or stop complaining.

I know right unordered_map and unordered_set are better than any C hashmap

>easy to use dependencies, especially small ones, especially language/framework integrated ones, create stupid programmers
The fucking cope in this post almost makes me feel bad for you.

blown the fuck out

why not both? i mean, at least the STL algorithms work flawlessly with the Qt containers, its even recommended in the Qt documentation.

QString is better than std string tho. as for data containers i think theyre pretty much the same.

the problem with Qt imo is that you have to go all in to really enjoy its benefits, and that means their awful memory management model, moc and macros hell

D suffers from the lack of direction. features are half implemented, buggy and slow. even the GC leaks ffs.. whats the point.

the creators use the language for experiment and toying around, and never follow through..

for instance, they start implementing a feature they think its fun, then after a lot of hacks when its (badly) implemented they get bored and move to the next thing..

check its back log, its full os critical bugs and technical debt due to all the hacks.. but they dont care because all they want is to play around with features..

the newest one is implementing a borrow checker.. because rust has it so they have to have it too, nevermind all the bugs and half assed features.

i hate them so much because i love D, it could be so awesome.. mixins are great.. and it has such a clean base language.. but the creators destroyed it..

if only a serious company would buy it and fix it.. never going to happen so we're stuck with c++ or rust.. feels bad

>just buy more hardware bro
this retarded mentality is why the software development world is in such bad state