Why learn C++?

Seriously, is there a reason to even use C++ besides games? The same can be done with C# or Java.

Attached: 0BAA459D-546A-479C-AE04-2330DDFA078D.jpg (1280x720, 110K)

Other urls found in this thread:

docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html
twitter.com/SFWRedditImages

Java doesn’t have pointers

C++ is a white man's language

What can you do with pointers in C++ that you can't accomplish in Java?

C# would be a decent language if it was truly portable and truly free, like C/C++ are. It's got some nice features. Java is a cat diarrhea milkshake, stirred, not shaken. C++ is generally all around better than Java. C++ has slightly less work for the same code, no factory bullshit etc. Memory management can be slightly tricky if you're an idiot.

Go ahead, learn it. Java is useless

actually program stuff

Wow really convincing.

Anyone have a real answer or do you guys just want to admit there's nothing you can do in C++ with pointers that you can't do in Java natively besides feel slightly more macho about your choice of programming language.

>used by 100% of the Fortune 500
>processing trillions of dollars of transactions every day
Java is second only to COBOL in impact. It's not useless by any means.

Actually Java pointers work quite ok, everything is accessed by a reference, which is pretty much a pointer.
But Java does not have value types, so for example when you have an ArrayList it's bad at caching, because you follow those pointers around to random memory, while an std::array is a contingous piece of memory.

The real reason why I started using C++ was reverse engineering and low level stuff though.

>is there a reason to even use C++
it's the best programming language out there so you could probably find some use for it

ArrayList in Java is contiguous memory.
It's just a wrapper class for an array. It grows the underlying array when it needs to, changing the starting address, but it's still contiguous - like using C's realloc on an array.

Good answer, thanks.

Java does have value types but you're right to point out that all implementations of lists and other collections are reference based. There are plans to fix that but they've not yet been picked up.

It annoys me that so much stuff is added all the time. And it's weird that it's done in the name of simplicity, but I don't see it.
C++ would be better off with better standard library support for threading for example than with pushing all those meta programming concepts.

It's true to my knowledge that it's contigous memory. But, maybe I am wrong here, all that is stored in an ArrayList is the reference. So the references are in contigous memory and accessing those is fast, but going to the actual data can be slow.
Of course the same can be said for an std::vector of std::string, but in C++ you have the choice not to use pointers when you use your own data types.

if you want simplicity learn c

C++ is the supreme language for competitive coding.
C++ is the supreme language for fast machine learning code
C++ is the supreme language for CUDA GPU programming
C++ along with C is the supreme language to understand computer architecture because of low level control

C is too low level for me.
I feel like C++ could have been simpler and still have most of the important features, on the other hand I am too much of a brainlet to really build a better language.

If C++ were the only thing that I need for work I guess I would be fine, but many companies want you to know several languages.
I know Java, some Python, some x86 ASM, some Haskell, but getting better and better at C++ takes up a lot of my time.

Bjarne says in his speeches that C++ should be a language that even a highschooler should be able to learn, I don't see how the development of c++ goes in that direction.

The only thing C++ is not the supreme language for is pseudo scripting language attributes rolled into a bytecode interpreter.

The interpreters for all of those languages are written in C though.

C++ is incredibly simple, the only thing that makes it complex is bad code. When a programmer tries to do too much at once in a single method, it becomes more and more complex.

1. fast
2. cryptocurrency/OS programming

>better performance in most cases
>no need for a 10^80 LoC VM to run a simple 10k LoC program
>explicit control over what gets passed as a reference and what doesn't
>no retarded "primitive type" bullshit

I'ma bite. In what aspects is C# not "truly portable and truly free". All the tooling is MIT licensed (is that the problem?), the standard is open, apart from the .NET Foundation stuff there's eg. Mono, there are even some people working on transpiling the IL to LLVM.

References are basically pointers in Java. They even throw a nullpointerexception fault when you try to dereference a null reference. It's the equivalent to a segmentation fault.

chop off your dick and become a real 1337 hacker

Attached: Rust_programming_language_black_logo.svg.png (1200x1200, 56K)

Attached: 1547786886188.jpg (709x821, 145K)

>Why learn C++?
For the same reason you learn Java: Real world problems and real world customers dictate the language you implement in.

Last project I worked on was 3D visualization of geodata. It had to be done in C++ or else it wouldn't have worked.

real answer:
because moores meme is dead.
because you can no longer count on twice-faster-every-2-year magical cpu to make up for your shitty programming you, are now forced to write an efficient, lean code.
and when you really want squeeze every bit of performance out of ur cpu while still have some high level abstraction mixed in there are really no alternative to c++

It's pointless even then. Lisp is much more pleasant to use even for games.

Even the "slowest" language implementation nowadays is fast enough for 90% of the shit you will ever write, even on low end machines.

Rust > c++

Attached: received_1255261577974179.png (433x567, 214K)

There are still problems where you have to process 500GB in less than a day, or process data in near real time so the process you're trying to control won't halt in your factory, or chemical plant, or whatever.

While what you say is true for the hobbyist, it's not the reality at the forefront of science.

This. The only way to keep your viriginity safe.

You should learn C because it teaches you good habits and fundamentals. Then you should learn C++ because you need to do OOP eventually and C++ is the best environment to learn OOP in. Then you can do whatever the fuck you want with whatever the fuck language you want. Having C as your foundation will allow you to learn any other language rapidly. Starting with a babby language will get you short-term results but is not going to serve you well in the long run.

>There are still problems where you have to process 500GB in less than a day, or process data in near real time so the process you're trying to control won't halt in your factory, or chemical plant, or whatever.
That's not part of the 90% I was talking about. Don't pretend you didn't know it already.
Besides, even then, many other languages other than C and C++ still have fast enough implementations for many of such tasks.

java does not have byte/bit level operations without extensions and C++ is managed so you have control memory usage if you want to optimize for that.

not useless, just shite

>java does not have byte/bit level operations
It actually does. It's not even a library, it's part of the language itself.

Don't listen to them,there are tons of jobs including Java.

>Embedded/Low memory environments (no OS to run java VM or too much memory usage)
>Low latency (can't afford GCpauses (e.g. high-frequency trading) & soft-realtime (e.g. games))
>Foundational libraries (c++ can easily expose a C API with extern "C" and requires no runtime (disable rtti & exceptions))
>Performance/Latency sensitive applications like audio/video processing, statics, inference.
>Direct communication with hardware
>Call C APIs with zero overhead

There are many situations where other languages are better than C++, so you may not really need it.
That said, if you do decide to learn it, please learn modern C++. Legacy C++ (until C++03) is dogshit.

>Performance/Latency sensitive applications like audio/video processing, statics, inference.
*statistics*

Also

My favorite r̶u̶s̶t̶ c++ features are:

zero-cost abstractions
move semantics
̶g̶u̶a̶r̶a̶n̶t̶e̶e̶d̶ ̶m̶e̶m̶o̶r̶y̶ ̶s̶a̶f̶e̶t̶y̶
̶t̶h̶r̶e̶a̶d̶s̶ ̶w̶i̶t̶h̶o̶u̶t̶ ̶d̶a̶t̶a̶ ̶r̶a̶c̶e̶s̶
t̶r̶a̶i̶t̶-̶b̶a̶s̶e̶d̶ ̶g̶e̶n̶e̶r̶i̶c̶s̶
p̶a̶t̶t̶e̶r̶n̶ ̶m̶a̶t̶c̶h̶i̶n̶g̶
type inference? (auto)
minimal runtime
efficient C bindings

goober it's not a matter of like "yeah well you can do the same thing with this other tool instead" it's about having the right tool for the job, consider what you're writing. It'd be a stupid generalization to say that C#/Java are the be all end all programming languages. a lot of the time people aren't even writing C#/Java by choice of the language itself, but instead the entire ecosystem surrounding it. when you write c++, you're basically in your own ecosystem. you choose depending on whether or not it'll save you time for your project

being even just a little bit unstable is enough to make it unsuitable for cross-platform production code

partially disagree on "the only thing that makes it complex", to me that isn't the issue. you could put that argument towards any programming language, since large methods aren't usually favored (though i'd prob disagree in a few cases, your code shouldn't always read like a choose your own adventure book)

the thing with c++ though is that to use it effectively you still have to have some knowledge of what's going on under the hood imo, like yeah you can get by without it but it helps a lot for debugging. that said it's worth noting c isn't exactly that low level

based

Java 9 (and java 8 to some degree) practically have pointers.

docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html

Attached: 1558947312084.png (1000x1000, 247K)

It does. It just doesn't call them that way.

Go try port C# code to macosx, android, windows xp, windows 10 and debian based distro and then report back how well did it go.

Finally a useful reply, thanks

Valid point. Do you have examples?

Not necessarily. I’ve been coding for almost 10 years and still don’t see the practical use of c++ besides OS.

This is what I wanted to know. Thx