Should you learn C++ in 2023?
ฝัง
- เผยแพร่เมื่อ 7 มิ.ย. 2024
- To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/DreamsofCode. The first 200 of you will get 20% off Brilliant’s annual premium subscription.
C++ is perhaps one of the most famous programming languages in existence. But is it worth learning in 2023? In this video, we explore some of the reasons that I think it is, and why you may want to consider learning it.
#cpp #coding #programming
This video features a sponsored segment by Brilliant.org
Become a better developer in 4 minutes: bit.ly/45C7a29 👈
Join this channel to get access to perks:
/ @dreamsofcode
My socials:
Discord: / discord
Twitter: / dreamsofcode_io
My Equipment:
Voice over: kit.co/dreamsofcode/voiceover
Coding: kit.co/dreamsofcode/coding
00:00 Intro
00:26 Versatility
01:15 Performance
02:13 Personal Development
03:02 Sponsor
04:21 Demand
05:05 Constantly Improving
05:58 Tooling
07:03 Complexity - วิทยาศาสตร์และเทคโนโลยี
To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/DreamsofCode. The first 200 of you will get 20% off Brilliant’s annual premium subscription.
Thanks, managed to be in the first 200. Doing the Comp Sci lessons!
you are the next fireship . love your way of explanation and depth of field . can you also make a video on how to setup c++ make(build-process)/cmake when working in neovim .
No fireship videos are not sponsred bny brilliant or hellofresh so there is that.
@@recursion.Conversely, he doesn't namedrop Tom Sowell and Mental Outlaw which is a big plus
love the voice
quick and concise
and i do get dreams of code
"Should you learn C++?"
"Yes, if you need it"
Almost all companies use it, so yes.
Great video, the editing was top notch! I started learning C back in July and have been enjoying my time with it. Haven't delved into the more complex stuff like manual memory management all too much, it scares me a bit😂
Trust me, it's not nearly as hard as some of the tutorials make it appear. Just learn pointers, they are invaluable concepts. Even if you move to higher-level languages you will still need pointer-like things otherwise you won't know how to structure your code well. I tried C# before C++ and I was dead-confused by reference types, turns out they are just pointers.
Memory management:
Your computer has two sections of memory: The Stack and The Heap. The stack is a section of memory where variables are essentially placed next to each other. Think of the stack like a literal stack of plates: you can only add to the top of the stack (adding a plate) or remove from the top of the stack (removing a plate). This keeps the memory consistent without causing any gaps or problems (if you tried removing a plate from the middle it would probably topple over). By default, all variables in C are allocated on the stack. This means all your variables are placed next to each other by default in the order they are declared. This is fast because the cpu processes data in chunks at a time. So when the CPU grabs one variable on the stack, it normally grabs some other variables alongside it for good measure too (at no extra cost). The only problem with the stack is that the variables cannot change size (because they all have to be next to each other). This is because if you imagine a variable growing in size on the stack, it might overwrite it's neighbours (not good).
So instead, when you have a variable that you want to grow dynamically in size (like a list) you need to allocate it in a separate place so it doesn't overwrite its neighbours when it grows. This place is called the Heap, and it's essentially just a random "Heap" of variables. The variables do not need to be next to each other this time, so there can be some gaps and slower performance, BUT your variables can be resized on the heap. You might also need the heap if the size of your variable is not known at compile time.
It's basically like a bookshelf vs a random pile of books, at least that's how I like to think of it. The bookshelf is more space efficient and faster, but the constraint is the books have to fit next to each other on the shelf. The "heap" of books is disorganised and slow, but you don't have the same fitness problems. You need to manage memory when you need to add or remove from the "heap", the stack is automatically done for you (variables are removed from the stack in the reverse order that they were added).
amazing explanation, thanks@@oscarsmith-jones4108
Nice video, Keep up the good work!
Thank you!
I appreciate this video :)
Yes!!!, Haskell video also please.
Thank you.. 🙂
I personally use C++ for one main purpose, and that's OpenGL and GLFW. It just... works (once you fix your linker issues). I've experimented a bit with wgpu-rs since I figured making a barebones engine in Rust could be fun, but... I did not mesh with it at all.
But I might just be old-fashioned and a bit too comfy using C languages, haha.
Yes i also mainly use it for OpenGL and GLFW/SDL2 and i really love the language, planing to actually use it more broadly and i personally dont have linker issues because i left windows and currently only use Linux for development and pretty much just do my “sudo dnf install glfw” and it does everything for me rskk
@@caasieu gringo não entende essa risada ai, melhor botar um lol
@@PCXyHOHSmF bem isso os caras conhecem só a própria cultura msm kskk
Although there is no proper package dependency installer in C++, vcpkg and conan i think are pretty good for installing libraries and generally make the job much easier to do
Package managers are a slippery slope. Avoid them at all costs. Languages that embraced them and even integrated them as a default tool are now collapsing under the dependency hell issues.
@@vitalyl1327rust where, cargo where?
From my experience use your build tool to your advantage. I use cmake so I'll first try find_package, then FetchContent, then vcpkg
@@vitalyl1327 😂
@@vitalyl1327 for which language besides JS do you see this being the case?
Hey t thank you for the video and can you make a video on should I learn C in 2024
Another DoC vid, another good day
Hello world has a bug??
It really does.
Im not a cpp dev but understand the language generally. Where is it? Other than that "std::endl" is bad practice and the example is (potentially) vulnerable to a bufferoverun, I see no issue.
I'm actually planning on doing a video about it! In C and C++ you can cause it to crash, basically.
I think you're the first to notice the buffer overflow 😂
@@dreamsofcode it's generally the case that once you see a raw char* (an array is a pointer) you can safely assume a bufferoverun to be present. I really don't understand why non length checked buffers even exist. The performance different is rarely a problem.
When's the haskell in 2024 video coming?
I'd argue that you don't need to learn C++ if you only want to learn the underlying concepts that have been abstracted away in higher level languages. C has most of them, and can be learned in a day, with the main exception being RAII and other drop-dependent data structures.
You do miss out on the STL, but you also don't have to uphold the invariants from the compiler - like making sure iterators don't accidentally get invalidated
That's very true!
If you managed to learn those concepts in a day, your IQ is well above average haha. But i mainly agree, C++ has many concepts that to me seems specific for the language, C has most that is useful in general and you can learn relatively fast (unlike C++).
I would really appreciate a good resource to learn CMake. I'm reading a book right now (it's the best in the market), and it's so boring.
Thank you for this comprehensive overwiew.
2:12 "Because C++ provides very little abstraction, ..."
This is not completely true. C++ provides a wide range between no abstraction (for example direct memory access) and very high abstraction (string class, chrono, regex, data types in Standard Template like unordered_map).
Yes
Have people found there is strong demand for C++ contracting still?
i have use high level lang. as java and java script any good free resource there to learn c++ with some projects.
Probably good idea is to watch through the cherno's series on C++. He explains a ton of concepts starting with how to set up a project and then going into more specific stuff. Though because the series is a few years old some of the more modern parts of C++ (ranges, concepts, modules etc.) aren't discussed in that series
The Cherno's c++ series on youtube is great
How do you make mobile apps with c++??
For logic: Android NDK or Objectove-C++ -> C++
For UI: Skia or Impeller
What a dope channel.
Yes.
Very nice video
Really doubt it'll ever surpass the F# milestone. People seem to be treating it only as a gateway ML. Ocaml, F#, Haskell pick whatever, they're all great MLs worth a programmer's time.
What's the F# milestone?@@raianmr2843
By popularity, you mean that Prime and TJ are talking about it?
@@raianmr2843 You forgot Elixir! It's great for web dev!
C is the real hero.
me getting brilliant offer 6 months later this video was released
Compared to D programming language, I'll say C++ has only got popularity/ecosystem advantage
I am learning C++ and Rust simultaneously and it really helps. The one has sth that the other doesn't.
What do you use to learn? Udemy? youtube? books?
🎯 Key Takeaways for quick navigation:
00:28 🌐 C++ is versatile and can be used for various applications.
01:10 🚀 C++ is known for its speed and low-level performance.
01:52 💡 C++ requires understanding of memory management and low-level concepts.
02:59 🎓 Learning C++ exposes you to foundational programming concepts.
04:23 💼 C++ remains in demand across industries and big companies.
05:06 🆕 C++ continues to evolve with regular updates and improvements.
06:01 🛠️ Tooling and project organization in C++ can be challenging.
06:57 🔍 Learning C++ requires patience due to its complexity.
Made with HARPA AI
Talking about buildsystem, CMake really should be the standard. Once I learned CMake it all clicked, I can use whatever library I want and compile my program without worrying about linking order, or any other problems without using a buildsystem. I think the only problem with CMake is a simple tutorial, just show the similarity with the compiler and it is easy. Yes CMake is very easy to use, just that first step wall is really a stupid thing I don't know why they can teach CMake effectively. And anything that teach C++ doesn't even mention what a buildsystem even is that is very stupid as well. I mean yeah back in the day people simply used compilers and then maybe a script then makefile, but it's 2024 now.
Now I am not say CMake is the best, there are other build tools that are less verbose and works too but they don't give full control like CMake does. There are a lot of tools out there is kinda overwhelming as well for sure.
premake?
0:40 This could lead to buffer overflow error.
C guy here but I think 2:00 is supposed to say int *x instead of int x
Good catch!
I heard that Rust is between C++ and Haskell somehow. Super video by the way !
Rust is safer C++ with just enough of a taste of Haskell to cause friction.
Rust is everything C++ wanted to be and more. I'll probably never come back to C++ unless I get paid to do so. That said, if you're planning on skipping C++ and jumping right on to Rust you should probably learn something like Zig or Odin later on. Rust's otherwise excellent DX doesn't really carry over to when you try to do anything bare metal. C++ is still pretty unique in that it'll gladly let you do whatever the f you want.
@@raianmr2843to see how rust low level can be done well I suggest you the channel "Low Level Learning" he has a few videos on bare metal rust and how to build custom 0 cost abstractions yourself. Because the reason rust feels clunky on bare metal is that for your specific bare metal Hardware especially in case of micro controllers there isn't any pre-built abstractions (or very little) past writing to raw addresses. The key is to write them yourself. This can also be a good exercise for library design.
@@raianmr2843 I agree. The last decade has brought us some great new alternatives to C++ that have learned from its mistakes: essentially start over with a clean slate, keep what is good and throw away the crud. I have yet to dive into Odin, but I would definitely recommend Rust or Zig to someone before C++ if they were looking to learn a lower-level language in 2023. While Zig/Odin are still somewhat niche, Rust has firmly established itself as a mainstream language that isn't going anywhere if the "mainstream" factor was a concern.
@@raianmr2843 Rust dropped one of the principles of C++ (freedom), so it is not what C++ wants to be.
The closed one is Zig, but it leaks many features, but ...shortly... could be an alternative.
OR a C++23 with an equivalent of cargo + static analyzer could be the "rust blocker".
Good 👍
I am impressed with the quality of your video
Thank you!
0:33 all Turing Complete languages can "do it all"
"hello world has a bug"
"godbolt is a real person"
Damn I've really touched the bottom of the iceberg am I
c++ is falling into a js situation. many hate it, the majority don't want to bother with it, but it just does the job
except even JS isn't that complex, the ecosystem is. C++ is rotten to the core in terms of design and people should really stop using it for new projects
@@marcs9451yeah just use rust fr
@@marcs9451 JS is not so complex, but it is on a good road to becoming complex (And differently from C++, where there are many reasons why it is so complex, JS is complex just for bad design choices).
@@marcs9451then what should be used instead?
no, use some modern languages that have package manager and dedicated build system. your %50 of your time in C++ will be wasted by trying to build your project, write the header files and trying to understand some undefined errors coming from nowhere. In short, you will hate programming when coding in c++.
but there are some exceptions; If you know what you're doing and you're a type of person who likes to have control over things, then c++ might be for you and you won't get highly affected from the things that C++ lacks of
I believe RUST is a very good alternative, also Industries like SPACE Research, Defense and other critical ones are moving to RUST, for its safety and Performance.
Except when you want to do anything with actual memory or custom allocators, rust is better than C++ in terms of benefits but it's equally as complex and annoying
Safety story of Rust is overrated. A few language features do not trump the tooling, which Rust does not have and unlikely to get. Compare the safety of Rust with MISRA-C or SPARK.
1) Rust is not so safe (but of course, it is safer than C++)
2) AS Marcs said, managing the allocator in Rust is just impossible.
3) Rust has the unique feature to become more complex than C++, when the software is big.
Keep dreaming rust shill
Prime sent me
when are you making a haskell video?????? great talk but can you give your opinion about C in another video? cheers from PERU
“godbolt is a real person” at the very bottom of the iceberg is kinda funny
If you need to solve a novel problem then C++ is good. For everything else there is a Spring Boot project that already does what you need.
C++ is still goat and I learned it balls deep first before then learning webdev shit with dotnet, javascript and all the other web shit.......... but that said, I fukin love Rust the deeper I get with it!
Yes, I should, I have an exam tomorrow
You are funny
I enjoyed working with C++. I love the control! But for me, Rust has replaced this technology. Performance is great with Rust as well as stability. Rust is hard to learn, C++ seems "easier" but has sooo many nuances. Most of the time you don't find out about these "nuances" until you are running your application and things start to act weird or start crashing.
I really like Rust, but I do find that C++ can be easier to use for certain cases. You're giving up a ton of safety however to do so!
C++ is still better for gamedev, Rust infrastructure is just not there yet
I found Rust to be hell for experimentation. You have to be very proficient in the language to make the program compile while managing different approaches to the problems you are dealing with. If you are not very good with the language usually it will have an inferir performance to Go (a much easier language), judging by some benchmarks i've seen. It's also pretty frustrating for learning data structures, which is a -1 for me because universities and college students will likely not use/study much the language (and so the ecosystem will not have as much young talent as it could).
All in all i find the language fun, but it's more appropriate in systems where security and stability is critical. Also i find it's pretty good for tooling.
rate my roadmap learning na new programming language (C++), my first prog lang is Java
familiarize the syntax first
1. BASICS, and OOP
2. Practice and solving data structure and algo
after that
1. learning the fundamentals:
a. data type
b. memory management
c. numerical system
d. pointers
any suggestion?? feedback?
in short b and d is the same
Im glad we had to learn it in Uni.
That said, I would never want to touch it again.
Yeah but its SOOOOOOOOOOOOOOO FAAAAAAAAARKINGGG VERBOSE...
someclass::somesubclass::someotherclass::somemethod::blapblap->badabing->badaboop(std::vector x);
Nah thanks even had enough.
And then memory leaks holy moly!
I didn't even attempt multithreading.. If I was still young but not anymore. Aint nobody got time for this!
C# is the lowest I'm willing to go just for the sake of time. It too can also do direct unsafe pointer operations if need be.
well still i am happy with C for now
C will always be my first love. These new languages like Rust and Zig are interesting and fun to use for the learning purposes, but C is where I feel at home and always go back to, warts and all. Luckily everything relies upon C at some points in its execution, so it is going anywhere, as much as many people might wish it would.
Why doesn't C++ have an official package manager after 40 years? As an outsider it's baffling.
Its by choice so that the dev can individually add only the needed dependencies, which can be critical in for eg microcontrollers and system level code
@@aviksaha1823 Ahh, that makes sense.
Because package managers are evil, and because C++ serves such a wide varity of platforms and use cases that no common approach to package management is even possible.
@@vitalyl1327 Cool. Thanks for the explanation! I've written a fair amount of Rust over the last couple of years and it's actually made me interested in C++ which may seem odd. Rust has a political nature to it that has become very distracting and C++ seems to just be about C++ and I like that.
not everyone programs in x86, x86-64
I like it when people say that C++ is fast. it always turns out they have no idea why.
I'd argue that C++ is not fast, but other languages are slow.
The additional abstractions, such as dynamic typing, garbage collection and lack of compilation all incur overhead.
What about you?
@@dreamsofcode reference semantics and automatic memory management can kill any programer's effort to increase performance, yes. C++ along with C and Rust can give a huge benefit here. what makes C++ even faster is static binding and compile time computation. that's sort of things only 1-2% of C++ developers can do.
in overall, I see many people claim C++ is fast and then write java-style code in it: dynamic polymorphism, heap allocations, automatic memory management via shared_ptr etc. it really hurts my feelings.
Yes, if you're into competitive programming.
Competitive programming?
@@ForeverZer0 a rewarding competition between programmers to write programs using a programming language as fast as possible and as efficient as possible.
No. Next
Okay,
I ~~know and can program on python
And i tryied C, but C is some mess for me, C++ slightly better.
But still can't understand how to divide properly...
Divide? The mathematical operation? Or am I missing something?
Errant was here
Oh boy oh boy i just like C :)
4:55 I don't think cpp is a forward facing language. It has a long history and a lot of lagacy code. But cpp is being phased out by many companies as to unstable, complex and error prone. Ideally learning cpp today should be for a lagacy maintenance reason such as Fortran.
now do rust >:)
Most of that sounds like Stockholm Syndrome to me though :)
😭😭 🤣
C is a terrible choice for first programming language to learn, and C++ is like 100 times worse. Back in the Triassic period when I was a CS undergraduate things like pointers pretty much broke almost everyone other than myself and one other student. He had no trouble as he'd already released a game on the Amiga for Team 17, and I was okay as I had come in via Electronic Engineering and done a bunch of work building a memory paging controller for Z80 and programmed it in ASM.
You absolutely need to understand how computers work in detail to be halfway decent with C/C++
I learned c/c++ when I was 16-20 from books almost 30 years ago. No Google, no stack exchange, no leet code, no youtube. Did have IRC so could chat with other devs but that was about it. It's really not that difficult...
I figured out pointers to pointers because I was writing a menu system for a 2d level editor I was working on.
Yes some rudimentary knowledge of how computers work is required to do programming.
The class syllabus was horrible, the problems was not the language.
at my uni they taught us both c++ and python simultaneously during our first year, most students preferred the better type system in c++
"C is a terrible choice", that sentence is so stupid...
The worst thing saw in my life are programmers who just know Java, Javascript, or Python, trying to write something in C, Fortran, C++, or even Rust.
I started with Python and 6 months later i started learning C. The learning experience was much better for me, i actually felt i was learning something, not just how to invoke functions to do something. I think it greatly depends of the goals of the person. If you want to understand not only basic programming, but how programs work, you should learn a more low-level language. But if your goal is much more practical, maybe sticking to these scripting languages is ok.
That's why i believe it's laughable that some universities use Python for Computer Science classes. I mean, come on man! That's the people that are supposed to have a deep understanding of how this stuff works!
you can't just drop this iceberg and not make a video about it
That is fair. Request granted.
Should you use a hammer in 2023? If you need it, of course!!!
If you would only learn C++ to learn low level stuff, stick with C.
I learned it getting my degree. My computer languages are Python, C, C++, HTML, Assembly, SQL and obviously binary. You should learn it but not as your opening programming language.
yeah binary, obviously, well looks like I'm stupid because C++ was the first programming language I've learned
Saying C++ helps you later learn other languages and programming concepts, is like saying "if you start every game in ultra hard mode, you will learn the concepts of gaming".
The "new features" add more and more bloat so noone knows the language to its full potential.
No
Should you learn Haskell in 2023
My choice is golang
It was built as a C++ replacement but especially for a better code base management if I remember correctly
Golang is in no way a replacement for C++, their use cases do not even overlap.
@@vitalyl1327 Yup, I agree. But popular cases, go is the best.
@@vitalyl1327 True story. According to this blog post (commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html ) of the Go team, their goal was to replace the use of C++ at google and convert the c++ users. But they completely missed
I have a video about learning Go in 2023 that touches on this! Although my quality wasn't as good back then so I apologize
But C++ is just unsafe Rust with classes.
simple answer is NO. as a sw eng who uses c++ every day, no dont do it
Im currently studying a degree on sw eng and the main laguage we use is c++. Why dont you recommend to program in this language?
@@DavidDiaz-zr2hv stress mainly. i care not just about user experience but DEVELOPER experience. its a memory unsafe language that syntacticly makes no logical sense and is extremely verbose.. i make 6 figures literally fixing c++ code written ages ago in my company
great point, but, rust is better
well, not if being employed is important to you
Rust is great... but
I don't believe it to be as versatile when it comes to some more low level concepts, but this is by design.
@@dreamsofcodeIt is as versatile, it's just.. um.. a pain in the ass to work with cos either you're purely in pointer territory or purely in reference territory anything in between is pain
Life is too short to use C++. It is tedious and verbose. This video claims C++ is high performance and low latency but then cites Adobe. Photoshop takes an hour to download and 15 seconds to launch. C++ creates bloated slugs.
No one should learn c++ any more.😂
But who will maintain all the C++ out there. 😭
No. Learn Rust.
AI generated tl;dr:
The video discusses whether learning C++ in 2023 is a good idea. C++ is a versatile programming language with a wide range of applications, including game development, web APIs, mobile apps, data science, embedded systems, and more. It offers high performance due to its low-level nature and is used in mission-critical applications like finance. Learning C++ provides a deep understanding of programming concepts like memory management, pointers, and threading, which can benefit other languages. It's in demand in various industries, and its constant improvement through new standardized versions keeps it relevant. However, C++ has drawbacks: tooling can be challenging, and the language's complexity might lead to mistakes while learning. Ultimately, learning C++ can provide valuable insights into software engineering concepts.
C++ was the second biggest mistake after JavaScript.
JavaScript is often implemented in C++ 🌀
@@dickheadrecs😂😂😂
No. Learn Rust. Maybe C
Yes.