the TRUTH about C++ (is it worth your time?)

  Рет қаралды 571,456

Low Level Learning

Low Level Learning

Жыл бұрын

C++ gets a lot of hate on the internet, and there may be good reason for that. I think C++ is misunderstood, and there are a few simple reasons why. Despite being designed around 3 simple principles, the language has inflated to have a ton of features that are either too complicated to understand, or too powerful to implement without making your code base unmanageable.
But, should you learn C++? Yes. There are a few caveats though.
🏫 COURSES 🏫 Check out my new courses at lowlevel.academy
🙌 SUPPORT THE CHANNEL 🙌 Become a Low Level Associate and support the channel at / lowlevellearning
Why Are Switch Statements so HECKIN fast? • why are switch stateme...
Why Do Header Files Exist? • why do header files ev...
How Does Return Work? • do you know how "retur...
🛒 GREAT BOOKS FOR THE LOWEST LEVEL🛒
C Programming Language, 2nd Edition: amzn.to/3OKh3q2
C++ Crash Course: A Fast-Paced Introduction: amzn.to/3qdZILK
The Rust Programming Language, 2nd Edition: amzn.to/3MHaS36
🔥🔥🔥 SOCIALS 🔥🔥🔥
Low Level Merch!: www.linktr.ee/lowlevellearning
Follow me on Twitter: / lowleveltweets
Follow me on Twitch: / lowlevellearning
Join me on Discord!: / discord

Пікірлер: 1 400
@LowLevelLearning
@LowLevelLearning Жыл бұрын
What do you think? Is C++ any good?
@MichaelMantion
@MichaelMantion Жыл бұрын
You made this video just to get drama. No you should not learn C++. Lots of people know it, few companies use it, most are moving away from it, there are better languages if are starting a project. Anyone leaning C++ will only annoy experienced users. Like you said. The first language anyone should learn is python, then Rust or C, then TS or JS. Maybe Bun. Everyone can use Python because there is always some quick little task that you can get done with python in a few minutes that will make any computer users life better.
@adfs774
@adfs774 Жыл бұрын
It depends on what your coding (I like c++)
@gregandark8571
@gregandark8571 Жыл бұрын
C++ MUST DIE.
@vectoralphaAI
@vectoralphaAI Жыл бұрын
@@MichaelMantion That's wrong. C++ is still being used in industry and will never go away completely.
@huntabadday2663
@huntabadday2663 Жыл бұрын
When I use C++, I program it like C, it is objectivly better.
@romangeneral23
@romangeneral23 Жыл бұрын
C++ is Life. People love to jump on the bandwagon of hating a language. But I always quote Bjarne himself "There are only two kinds of languages: the ones people complain about and the ones nobody uses"
@user-fr2fm3ri3w
@user-fr2fm3ri3w Жыл бұрын
Except for Java , both nobody uses it except for Indian tutorial makers and somehow everybody still hates it.
@xesbeats8180
@xesbeats8180 Жыл бұрын
@@user-fr2fm3ri3w nah errybody use Java
@ryantony5586
@ryantony5586 Жыл бұрын
@@user-fr2fm3ri3w java deserves its hate.
@fr3dlopez
@fr3dlopez Жыл бұрын
@@user-fr2fm3ri3w nobody uses it.... lol what field are you working in?
@user-fr2fm3ri3w
@user-fr2fm3ri3w Жыл бұрын
@@fr3dlopez it used to be good for cross platform and for android but it got murdered by kotlin and electron. Maybe it can still be used in a server but go and rust are flat out better. Companies that use Java still only do so because it’s too expensive to migrate, Java’s market share is falling each year however
@bencemali9528
@bencemali9528 Жыл бұрын
C++ is a superset of C not a subset
@LowLevelLearning
@LowLevelLearning Жыл бұрын
words are hard. you right
@theawesomefire
@theawesomefire Жыл бұрын
Though C++ is not a strict superset of C, as it is not 100 % compatible with C. Depending on the standard of course, as the latest C and C++ standards try to move to a closer common ground again.
@retsu-h6460
@retsu-h6460 Жыл бұрын
As is mentioned in the video, C++ is C with object, so doesn't that mean C++ is a subset of C?
@shimadabr
@shimadabr Жыл бұрын
@@retsu-h6460 If C++ was a subset of C, C++ code would be valid C code, which is not the case, it's the opposite. But as mentioned, it's not a 100% superset anymore since C99.
@KenJackson_US
@KenJackson_US Жыл бұрын
​@@theawesomefire: _"Though C++ is ... not 100 % compatible with C."_ I wish I could remember the issue, but years ago I went round and round with another developer because I gave him a few lines of simple C code that I compiled and tested with my C++ compiler. It worked flawlessly for me but he argued that it didn't work for him. When I finally tested it with a C compiler I found he was correct.
@zackakai5173
@zackakai5173 Жыл бұрын
I like how people always talk about "which language should you learn" as if we're often given a choice. In my experience, unless you're writing stuff totally from the ground up (or just wading into a new language as a hobby), which language you use is almost always dictated by what software you're developing for, or what your job or school requires you to use.
@sososo3906
@sososo3906 Жыл бұрын
I wish I would have known that before spending years on low level programming before realizing most relevant jobs will require proficiency in another field
@HaiderAli-em6ku
@HaiderAli-em6ku Жыл бұрын
Exactly. and this is why I hate people who push others looking in from outside the industry to only learn a single language like python to start their journey. You gotta learn a lot of things first to narrow down what you wanna go into and then you dive deeply into its requirements.
@andrewdunbar828
@andrewdunbar828 Жыл бұрын
It's mainly about which language to choose to learn for people that haven't started yet or haven't progressed very far. They'll be training themselves in both programming and the language they choose and that choice partly depends on what work might be available, what they want to do, and what is good at a learner level.
@sososo3906
@sososo3906 Жыл бұрын
@@andrewdunbar828 shouldn't they choose a subject instead of a language?
@andrewdunbar828
@andrewdunbar828 Жыл бұрын
@@sososo3906 They will choose many subjects. That's what everyone I knew did, though there were fewer languages to choose from then.
@theoceanman8687
@theoceanman8687 Жыл бұрын
I am currently learning C++. I learned Python, Java and C for my CSE degree. I can say that I prefer C++ over Java because C++ feels more intuitive for me. Of course, I have yet to learn Rust.
@sotam8938
@sotam8938 Жыл бұрын
Should've just skipped to Rust.
@olafbaeyens8955
@olafbaeyens8955 Жыл бұрын
The first 2 months learning Rust will be very painful, but it is probably going to become your favorite language.
@punchcake4832
@punchcake4832 Жыл бұрын
@@sotam8938 Well rust isn't really good for jobs, C++ still and will forever have codebases to maintain. C++ isn't horrible the programmers abusing its concepts are thus resulting in its reputation for memory leaks, Try to use smart pointers and keep raw pointers as a last measure.
@theoceanman8687
@theoceanman8687 Жыл бұрын
@@punchcake4832 At the end of the day, programming languages are tools, each with their pros and cons.
@yurikadzz
@yurikadzz Жыл бұрын
C++ is the building foundation of a lot of stuff in our world nowadays...
@Squov
@Squov Жыл бұрын
My first language is C++, i've been exposed to pretty harsh concepts before that make the brain fry. C++ did sure fry my brain the first 3 months; but now that I am starting to understand it more, I really appreciate it and other languages are really easy!
@yurikadzz
@yurikadzz Жыл бұрын
If you can learn c++ you can learn any other language lol
@Squov
@Squov Жыл бұрын
@@yurikadzz truth brother
@Henry-sv3wv
@Henry-sv3wv Жыл бұрын
okay, now do X86 assembly, must be easy now :P
@user-xw4od8kb7y
@user-xw4od8kb7y Жыл бұрын
@@Henry-sv3wv Assembly, especially x86 might unironically be simpler than C++ or even C atleast in terms of syntax. it's just more tedious, time consuming and requires a solid understanding of how the CPU registers and memory stack work.
@isuckatthisgame
@isuckatthisgame Жыл бұрын
@@user-xw4od8kb7y Bro, can you recommend any beginner-friendly literature (if such thing exists lol) on asm and cpu architecture?
@KenJackson_US
@KenJackson_US Жыл бұрын
I wrote C and then C++ for years as an embedded software developer. As the language grew more and more complex, I noticed developers very purposely wrote more and more complex code which took longer and longer to read, trace and understand. Worse, there was a convoluted arrogance that came along with it. If you couldn't understand their extremely convoluted code, you were a lesser person. Few acknowledged that convoluted code was bad code. And discussions about the language replaced abstract discussions about what the compiler and processor would have to do to accomplish something. It became essentially _wrongthink_ to even consider how a compiler would implement code. While I was constantly striving to simplify the organization of data and the processing of it, my coworkers were constantly building empires of more and more complex code to their own glory. They _hated_ me when it got in my way and I simplified it.
@xyber2
@xyber2 Жыл бұрын
I've had similar experience in my job. Unravelling my co-workers fancy and redundant code was a gruelling task.
@XenolVlatriX
@XenolVlatriX Жыл бұрын
what do you do as a embedded developer? sounds interesting
@KenJackson_US
@KenJackson_US Жыл бұрын
​@@XenolVlatriX: _"what do you do as a embedded developer?"_ Embedded computers are those with no user interface or a limited interface. The microcontroller in a microwave is the most familiar example. I worked with telephone switchgear, solar controllers and bus communication systems.
@mirroredvoid8394
@mirroredvoid8394 Жыл бұрын
Terry davis once said the simple mind craves complexity or something like that.
@Honken
@Honken Жыл бұрын
Thank you. I work a few million lines of crap above you (web), fighting the complexity demon wherever it decides to come to nest. It's come to be point now where I find myself having discussions with senior engineers over the extreme danger of writing for loops in bounds-checking, memory managed languages, as 'you could get them wrong' and 'they are hard to read'. I would give someone elses arm to write Go on the frontend, anything but JavaScript.
@aleksandarnikolic2441
@aleksandarnikolic2441 Жыл бұрын
Professional C++ programmer here: The thing is that C++ has a steep learning curve and that most developers just don't want to invest the time to learn the language. Just as you've said: with great power comes great responsibility and rarely anybody wants to be responsible because it is hard. Also C++ is usually taught wrong and rarely do teachers or courses explain that, for example, raw ( C ) pointers are not evil, they just cannot be owning pointers. I agree with your suggestion on how to learn C++, I would just add that after learning C, fammiliarize yourself with the abstractions that the language introduces, by reading books and watching convention lectures. That way you get a bottom up ( learning C and the memory model) and top down (learning abstractions) view of the language. You just need time to understand the language, something that most people do not have today. C++ is not a perfect language, but it does not deserve the hate it gets.
@Dulge
@Dulge Жыл бұрын
agreed, im not a proffesional neither intermediate of the language but when you dedicate time to the language and actually understand the ins and outs its pretty awesome, the power we have also its a must for anyone wanting to get into malware analysis or Reverse engineering
@christophernoneya4635
@christophernoneya4635 Жыл бұрын
I tried getting into c++ for a while (currently i use rust) but I'd say c++ more than any language requires you to just "know" things, or at least thats how it feels. Like solid code sometimes just wont work because theres some quirk of the language or compiler or something that just screws with specific implementations that seem like they should work. It feels like to bugfix you need to have a textbook just containing these irregularities of the language itself Also header files confuse me because im kinda dumb but thats just a c thing
@user-sl6gn1ss8p
@user-sl6gn1ss8p Жыл бұрын
I realize this is a month old, but could you by any chance expand a little bit on the idea of "raw pointers are ok so long as they're not owning pointers"?
@aleksandarnikolic2441
@aleksandarnikolic2441 Жыл бұрын
@@user-sl6gn1ss8p Well, the thing is owning pointers are pointers which manage the lifetime of the object they are pointing to. That means that smart pointers in C++ are owning pointers because they have to destroy the thing they point to at the end of its lifetime. If A owns B, that means that A has to destroy B when the time comes. That means that Non-owning pointers do not manage the lifetime of the object they point to, they just "look" at the object. They don't have any obligation to the thing they point to. That is why raw pointers are "ok" to use in a non-owning scenario. They are great if your function requires a view to the object. Nothing is hindering you to use pointers as you wish, but abrstractions like these are really handy when you have to reason with code that you are unfamilliar with. The purpose of abstractions is to carry intent. I hope that I made it a bit clearer. :)
@user-sl6gn1ss8p
@user-sl6gn1ss8p Жыл бұрын
@@aleksandarnikolic2441 thanks, it does seem to make a lot of sense : )
@sledgex9
@sledgex9 Жыл бұрын
The answer to number 2 "avoid sugar" should be "for (auto& num : v) {//code here}". Way simpler.
@danielsan901998
@danielsan901998 Жыл бұрын
range-for loop is just syntactic sugar equivalent to an iterator loop.
@1337dingus
@1337dingus Жыл бұрын
Yeah. I guess std::for_each(v.begin(), v.end(), []() {}); exists too, but I never understood why you would do that instead of ranged for.
@sledgex9
@sledgex9 Жыл бұрын
@@danielsan901998 range-for loop also works on arrays. Furthermore, it doesn't matter that it is syntactic sugar over something. It matters that is a better syntax. Iterators suck because they are verbose and ugly.
@danielsan901998
@danielsan901998 Жыл бұрын
@@sledgex9 it does matter that it is syntactic sugar because the point was "avoid sugar", and for-range loops is an example in favor of using syntactic sugar.
@sledgex9
@sledgex9 Жыл бұрын
@@danielsan901998 IMO, I took it to mean "don't structure your code in a way just to make use of all c++ features". Notice the absence of std::vector in the second example. If I was wrong in my interpretation of his point, then I consider that point a wrong one. Using syntactic sugar that makes things easier to write/read and less bug prone (off-by-one error in for-loop), is a MUST. Otherwise we should avoid lambdas too because they too are syntactic sugar over special structs.
@lacelume9158
@lacelume9158 Жыл бұрын
0:20 Bjarne tweeted about c++ 4 years before the invention. the power of his programming
@tanujcherian3911
@tanujcherian3911 Жыл бұрын
my dude🤣🤣
@victotronics
@victotronics 2 ай бұрын
"tweeted" ?
@vibaj16
@vibaj16 Ай бұрын
@@victotronics yes
@srys25
@srys25 Ай бұрын
@@victotronics are you born now or what?
@chicoern
@chicoern Жыл бұрын
This systems administrator here, used to safe languages like c#, wanted to learn c++ to get closer to the OS. And man, I can't recommend enough. I got a pretty bad beating from memory management, and the community being fairy aggressive, but this language is powerful. Go for it.
@xvxluka222
@xvxluka222 Жыл бұрын
I recommend using smart pointers as much as you can. With those you can be in 99% of the cases sure that there won't be memory leaks
@vikingthedude
@vikingthedude Жыл бұрын
I’m somewhat of a masochist myself
@chicoern
@chicoern Жыл бұрын
@@xvxluka222 I do whenever I can, but sometimes raw pointers are better, when calling native OS functions
@Tibor0991
@Tibor0991 Жыл бұрын
@@chicoern heads up: look for std::out_ptr, it's been invented to deal with OS calls that expect in-out raw pointers.
@chicoern
@chicoern Жыл бұрын
@@Tibor0991 oooooooh didn't knew that! Thanks buddy!
@josefcapousek6126
@josefcapousek6126 Жыл бұрын
I study mechanical engineering, so I'm not a typical programmer, but from my point of view C++ is one of the most important languages. It can be found in any application where speed matters, such as CAD modeling software, physics simulation, or real devices such as microcontrollers, control units, etc.
@Stumashedpotatoes
@Stumashedpotatoes Жыл бұрын
There are modern alternatives now tho, so no, it cannot be found in ALL projects where those things matter…
@sharoyveduchi
@sharoyveduchi Жыл бұрын
@@Stumashedpotatoes "uhm ackshually" yeah yeah shut up. It probably STILL can be found in all those projects but indirectly. Rust for example uses LLVM to be compiled and LLVM is programmed in C++.
@Stumashedpotatoes
@Stumashedpotatoes Жыл бұрын
@@sharoyveduchi my point was that you do not need to write CPP yourself to get the performance of C, by using rust or zig. Buddy you just did the biggest “um actually” I’ve ever seen. You brought up the fact that the compiler is written in cpp. “Umm akshually the compiler is written in cpp so youre still using it even when you’re not”. You gonna tell me Linux is written in C too? Cringe bro, cringe
@koodikoodi1040
@koodikoodi1040 Жыл бұрын
@@sharoyveduchi Fair point but unnecessarily vitriolic, Stuarts remark was completely fair and nothing about it was offensive.
@r2com641
@r2com641 Жыл бұрын
@@Stumashedpotatoes idiot. Every big electrical and mechanical CAD which used to build stuff we use in our life is coded in c++
@alexandrohdez3982
@alexandrohdez3982 Жыл бұрын
I agree ... first C and then C++. Working with object required a extra efford like understanding Inherince, poli, object relationships, notation like UML diagram classes a more... great video by.the way 👏👏👏👏
@Zex-4729
@Zex-4729 Жыл бұрын
C++ is my first language, best benefit of it is after that learning other languages is super intuitive. And about learning C before C++ isn't really needed if you have good resources to learn from. But if you want to learn C++ in a sloppy or playful way you will struggle(unless you are a genius). Most painful part of C++ is build systems, you have to learn the compiler and package management etc. well, as long as you don't use IDE that is, with IDE it's much simpler of course, though still harder than other languages.
@vocassen
@vocassen Жыл бұрын
Agreed, working on a project that stretches 4 platforms (windows, linux, microcontroller, embedded linux) and build systems are a pain to get right if you don't want to enforce usage of a specific IDE. CMake frustrated me to all hells with how most of the methods turn out to be "not recommended anymore" but then recommended methods for cross-platform use are lacking BIG TIME (especially how msbuild wants release+debug setup, I ended up dumping that), overall CMake was really unintuitive. NMake started fine (basically a simple syntax change from Make) but became a real drag once it got a little more complex with how badly it is supported. So I now use CMake for windows so I don't have to deal with manually maintaining msbuild project files, Make on Linux, Make for Microcontroller, and a simple CMake + SH for embedded linux. I dread the day something requires me to touch it again.
@mcgames4455
@mcgames4455 Жыл бұрын
​@@vocassen have you tried premake its available for windows linux and mac?
@johanngambolputty5351
@johanngambolputty5351 Жыл бұрын
I wish I had learned C before C++ (I learned it as a module on my math undergrad), I've gone back to them a little since using OpenCL. Once I get a bit more of a wide overview of what they can do, because I still haven't built that much with them, and once I have looked into assembly and mixing all three, then I think I will finally let go and probably leave them for something like rust... but I want the context first.
@ginxxxxx
@ginxxxxx 10 ай бұрын
don't waste your wishes, because like a plant, you should water the best and cull the rest.
@nachosncheez2492
@nachosncheez2492 Жыл бұрын
nice, perfect timing. was going to make a system project, and was really battling with this question.
@TranscendentBen
@TranscendentBen 7 ай бұрын
Just the feature is worth learning C++ over (or in addition to) C, it's better and safer than C arrays, and there's a lot of other good features. Unfortunately, there's always "more" every three years, every new version is almost like a new language, as so many things get (literally and figuratively) overloaded. Even thought the latest tends to be an improvement (as in "for (auto thing : mythings)"), it still leaves a trail of a half dozen previous ways of doing something.
@TheRussianhippie
@TheRussianhippie Жыл бұрын
honestly, I've used a ton of languages and I still find C++ to be my favorite language. I do use python for a lot of one-off type things that I intend to work on for less than a few hours, but I genuinely find C++ more fun because I can always find a trick to make my code be better.
@sososo3906
@sososo3906 Жыл бұрын
If you're not using it for your job try rust and never look back
@KopieOG
@KopieOG Жыл бұрын
@@sososo3906 rust fanboys again ruining everybody days
@sososo3906
@sososo3906 Жыл бұрын
@@KopieOG your right, finding out that the multi million dollar code base your company developed for 30 years will cost about as much to rewrite to be understood by anyone besides the original writers won't ruin your day, it will ruin your life
@hodayfa000h
@hodayfa000h Жыл бұрын
i use python for automation and c++ for making programs
@sososo3906
@sososo3906 Жыл бұрын
@@hodayfa000h if the code is written from scratch you should write it with rust, also it easy to make a python library and only implement in rust the bottlenecks of python
@MrMShady
@MrMShady Жыл бұрын
My first language was C++ and I couldn't believe that other languages ain't got the features it has. I remember I was like: so how they do this and that?! Now I know they just don't ;) C++ is the power but only after few brain-aches. I think most of the haters just failed with the language and others are repeating the haters.
@viktoreidrien7110
@viktoreidrien7110 Жыл бұрын
Valuable info as usual, thank you my friend, useful info from an experienced engineer is as good, if not better, than a proper engineering book. love your insights, I am currently learning C++, I just finished C. Also learning Python.
@eightsprites
@eightsprites Жыл бұрын
I think error messages from a C++ compiler is just to complicated. And dont say ”just learn it”, this is what I think: the error messages are to complicated. I got a lot of C++ books, I read them, I still don’t use C++. I happily use C or Java, even C# or Javascript. If a library has a C++ or a C API, I use the C API every single time.
@0xTas
@0xTas Жыл бұрын
Have you tried Rust? The error messages from that compiler are consistently the most helpful I've ever seen.
@eightsprites
@eightsprites Жыл бұрын
@@0xTas I actually havent. I tried Go but not Rust. Thanks for the suggestion.
@4cps777
@4cps777 Жыл бұрын
I think that C++ does solve some of C's problems as a general purpose programming language (although it's questionable whether C should be used as one in the first place when there are languages like Rust) but it creates even more of them. As such, my "personal style" of C++ is basically C with some extra things about C++ that I like (most notably the standard library).
@MrZapper1960
@MrZapper1960 Жыл бұрын
For me, understanding RAII as a mechanism for letting the compiler safely manage your resource lifetimes was eye opening. It moved me away from this “code in C” style
@juniorjunior8494
@juniorjunior8494 Жыл бұрын
I learned higher level languages first and C++ before recently learning C. I can tell you, for embedded systems, C is still much preferrable compared to Rust, especially when doing bare metal. C is almost married to embedded systems in a way other languages aren't. And personally, having now learned C, i think for complex systems, it can be a death trap, but it's simplicity also taught me how be efficient as a developer, especially with memory
@4cps777
@4cps777 Жыл бұрын
@@juniorjunior8494 I do agree but that's why I specified that I'm talking about general use cases and not special ones like embedded.
@stera182
@stera182 Жыл бұрын
@@4cps777 Even if this common belief of "C is better for embedded system" is completely false, they are tons of project in C++ and rust for embedded system. Arduino uses C++, ARM dev program libraries are in C++. C is used as a lingua franca so devices drivers are written in C so it can be used for every single languages, that’s all. Once you said that, nothing force you to use C as most languages can use C ABI.
@stera182
@stera182 Жыл бұрын
But even drivers can use a C abi and under the hood be written in C++ or even rust.
@kamkamkil1
@kamkamkil1 Жыл бұрын
in my opinion the most important thing with using cpp is having guidelines in your project, you can accomplice same thing many different ways in cpp so at the beginning of the project you need to decide how you will design everything. For example In my work we just don't use inheritance or most of stl. I also think that rust will have the same story (both are big languages and things like error handling should be clearly defined)
@kamkamkil1
@kamkamkil1 Жыл бұрын
also what i forgot to mention is that build system can be VERY complex in cpp. I don't have a lot of proffetional experience working with other languages but I don't think that in java or c# properly setting up build system can be so hard (even with cmake)
@olafbaeyens8955
@olafbaeyens8955 Жыл бұрын
Good developers makes everything work fluently in any language 🙂 I understand what you mean with guidelines, but you also need some freedom to break the guidelines to find better ways. I see a lot of projects becoming hard to handle because of enforced guidelines. I think within the same project the code should be consistent. But between different projects the consistency can be different depending on the projects need.
@Tibor0991
@Tibor0991 Жыл бұрын
Not using STL in 2022 is shooting yourself in the foot from the start; why avoid type and memory safe structures with zero memory and performance overhead?
@kamkamkil1
@kamkamkil1 Жыл бұрын
@@olafbaeyens8955 of course i mean in single project single guildlines, as for flexibility in smaller project it should be fine, personally i work on 5g with hundreds other people so rules are enforce at ci level
@kamkamkil1
@kamkamkil1 Жыл бұрын
@@Tibor0991 we just use boost ore have our own libery
@frenchmarty7446
@frenchmarty7446 Жыл бұрын
As someone who started with Java, C++ is very rewarding. I get the same OOP and functional features I'm used to plus equally great libraries without the overhead of the JVM. C++ is definitely *not* a "better" C. C is much easier to tinker with and iterate (without worrying about brittle design choices). C++ features and documentation almost always assumes you already know exactly what you want to build before you've written a single line of code. It is the complete opposite of say Python where you are guided towards the correct way of doing things.
@paulrei00
@paulrei00 Жыл бұрын
As Bjarne once said, "there is more simple and smaller language in C++" and Herb Sutter recognised this language and called it Cpp2 (cppfront)
@atypicalprogrammer5777
@atypicalprogrammer5777 Жыл бұрын
C++ is and will likely always remain my main language, and the unique features of C++ can be quite beautiful in some cases. I have been working with the QEngine library for simulation and optimization of quantum physics, and it makes extensive use of templates and operator overloading to allow me to essentially create a Potential or Hamiltonian (a kind of functions which tells us how a Quantum system evolves) as a C++ object, by literally writing it as an equation. But I absolutely agree, if you try to use "advanced" c++ features where normal C would do the jop it gets messy very quickly, and the error messages are not great, especially when templates are involved. I routinely get single error messages so long that they can not fit in my terminal.
@Michal-vz7ms
@Michal-vz7ms Жыл бұрын
I have seen C++ being abused in embedded, especially using OOP patterns for every problem. Instead of making systems easier to understand, codebase grows ridiculously. Off course there is a sense to choose C++ for some solutions, but in firmware development I follow my philosophy of 'staying with C if I can'.
@ginxxxxx
@ginxxxxx 10 ай бұрын
goto spaghetti is anathema to programming, drop down coupling is pure miscegenation of coding. DRY? if repeating is the root of all evil (silly uncle bob) then i am WET because virtual is infinite.
@melphiss
@melphiss 6 ай бұрын
There’s no better language than C to understand how hardware works, that’s why I’ll also stick with C for embedded
@TylerHerwek
@TylerHerwek 8 ай бұрын
If you learn c++, you can learn 80% of the other languages in a week.
@lorensims4846
@lorensims4846 Жыл бұрын
The first programming language I ever learned was IBM 360/370 Macro Assembler which is actually rather high-level as far as assembly languages go. They thought we should learn this before moving on to COBOL and CICS. Also, AL was the "washout" class. If you can't handle that you don't belong here. When a friend of mine was in the same program years later he asked me what he should learn after AL. I suggested C because it was the new hotness, the syntaxes of many other languages are similar and it's still low-level enough to let you do whatever you want. It's a good baseline. I've since learned that you can also do object-oriented programming in C using pointers to structures of pointers, but that makes my head hurt almost as much as the SmallTalk-style objects in Objective-C. So much is already written and can be written in C++ that it makes sense to know it. But while it's relatively easy to know C, if not always the best ways to use it, it's pretty impossible to know all of C++, much less how to use it well. C++ is a Very Complex language, though still low-level enough to be one of the fastest languages out there. Rust is more trouble than it is worth. I prefer Swift. It feels much more natural to me. But still, many device drivers are still written in C++ or even C so it's worthwhile to know them.
@plebisMaximus
@plebisMaximus Жыл бұрын
I heard it was efficient, so when I finally decided to learn a programming language, I picked that one. Bad, bad idea, but it's working out ok so far, I got the basic syntax after just about 20 hours of online courses and it feels intuitive enough to use. Can recommend.
@shimadabr
@shimadabr Жыл бұрын
About C++ security, I think most of the common problems that Rust solved, C++ already did too. The "problem" is that while in Rust they're there by default (and you can't escape it), in C++ they're opt-in (but highly encouraged by the community) features or patterns like smart pointers, RAII, etc. Smart pointers are, in practice, C++ ownership system. C++ has a legacy of 30+ years, so a lot of legacy code and "legacy programmers" still use the old verbose, unsafe patterns, it's also the style teached at most universities (remember folks, professors usually don't stay up to date with the industry or language features). But I see a lot of effort by the community to enforce these new patterns and document them. For beginners it's a challenge to soak up and distinguish so much legacy knowledge together with the new knowledge. But I'm having a lot of fun in my journey.
@dynfoxx
@dynfoxx Жыл бұрын
I think C++ is going in the correct direction with safety. Though they will never get as far as Rust. The main things that still bug me when working on C++ is threads safety and lifetimes. Companies I have worked with have flat out ban threading because it just causes so many bugs in what needs to be a safe system. Lifetimes are just never explicit in C++ you just have to hope things are documented well. C++ is not bad but it has years of issues that cannot be fixed.
@someonespotatohmm9513
@someonespotatohmm9513 Жыл бұрын
@@dynfoxx I think the threading issue is due to the not explicit (bad) lifetimes in c++. The first time I managed to get UB in an actual project was because some undocumented behavior in a library causing a pointer to that was required to become invalid. It took me days to figure it out because I checked if it was valid the line before I passed it. Multi threading itself is not that difficult, but using it efficiently usually means there are a lot of side-effects that become hard to keep track of. But if you have some expensive algorithm iterating over a lot of "uncoupled" data, it is not that hard.
@dynfoxx
@dynfoxx Жыл бұрын
@@someonespotatohmm9513 it's not that hard in theory. But when C++ gives you no help and it's up to documentation that may or may not be followed it gets to be a problem. The fact that programs don't know atomic, volatile and shared pointer safety just gets annoying. Half of the issue is that you can do it right but it's just hard to keep right. If I am not careful some other person will come mess it up. They need owning mutates like rust has. It makes it more clear to start with. Though it will never be fixed it more so comes down to your code base and fellow engineers.
@radivojevasiljevic3145
@radivojevasiljevic3145 Ай бұрын
Short overview of Modula 3 and Ada gives an idea that Rust solved the problem which was solved long time ago, just not in world of C-family languages. Yes, it needed few decades to catch up, but better ever than never.
@aallfik11
@aallfik11 Жыл бұрын
I think the amount of control c++ gives is double edged sword, but I like it. On one hand, you sometimes have to write a lot of lines of code to do something that other languages would allow with just a few, or sometimes even out of the box. On the other hand, though, I feel I'm in control and it's ultimately up to me to decide what a piece of code will do down to the really fine details. With some other languages it felt like someone took the steering wheel from me and just said "don't worry, I'll handle it" while blindfolding me.
@honaleri
@honaleri 10 ай бұрын
I totally agree. I have the same feeling. I'd prefer be in control then to just have "trust me, bro" experience when I'm trying to worth with technology.
@fab9207
@fab9207 Жыл бұрын
look at it this way, the ones complaining about c++ are the ones writing articles and not code
@sorek__
@sorek__ Жыл бұрын
C++ is awesome, its std:: library that is bloated and bad. Zero cost abstractions, OOP, overloading of operators, auto, quality of life stuff (default function overloads). I use it all the time on my embedded stuff, it's just great if used properly (basically as C with good stuff).
@LowLevelLearning
@LowLevelLearning Жыл бұрын
Totally agree. It's a good language that is VERY easy to use incorrectly.
@michaelmueller9635
@michaelmueller9635 Жыл бұрын
It's like C++ wants to do it all and integrate all new languages into C++style, at the time the new languages were hyped.
@sledgex9
@sledgex9 Жыл бұрын
What? STL is its strong suit. It is very powerful and useful. Just take a look at the module. And you pay for what you use from it.
@michaelmueller9635
@michaelmueller9635 Жыл бұрын
PS.: The funny thing is, that all C++Conference talks got a strong Rust-flavor in 2022 xDDD
@sorek__
@sorek__ Жыл бұрын
@@sledgex9 you are right but for embedded most stuff is bloated and MISRA discourage usage of std library
@metal571
@metal571 Жыл бұрын
Learning C first will tend to lead a developer towards a C-like C++ style. This tends to defeat the purpose of C++; See Kate Gregory's talk "Stop Teaching C". Avoiding sugar is also not the best approach, and in fact the range for loop over a std::vector generates less assembly instructions than using a traditional loop variable. You can prove this in Compiler Explorer with -O3 and is mentioned in Bjarne's book A Tour of C++ 3rd Edition. This makes some sugar in C++ what Jason Turner calls a "negative cost abstraction". Also "near zero cost" is not quite right. The language design involves what they call the Zero Overhead Principle, which is often misunderstood. This means not that there is actually zero overhead in using an abstraction, but that if you implemented it manually by hand using only C or assembly, you wouldn't be able to do better. At least, that's the goal...I won't go into how exceptions allocating and Run Time Type Identification are clearly in violation of this.
@vitgardon4896
@vitgardon4896 Жыл бұрын
C++ was my first language and I am so happy that it was that way. It forces you to learn about the fundamentals so that you understand what is happening with code under the hood. Also, it has the best syntax. No scope by indentation and it is precompiled.
@thecoolnewsguy
@thecoolnewsguy 8 ай бұрын
No needed for C++ here. You could just get around with C which is much simpler and easier.
@anon1963
@anon1963 7 ай бұрын
@@thecoolnewsguy hmm nah, unless you want to do embedded stuff
@thecoolnewsguy
@thecoolnewsguy 7 ай бұрын
@@anon1963 I meant in terms of learning the fundamentals of memory management and programming not in terms of getting a job or building a software.
@judostuff9233
@judostuff9233 8 ай бұрын
@LowLevelLearning Is it not a superset instead of a subset like you said in the video?
@noeldev
@noeldev Жыл бұрын
C++ is C but 1 higher
@BederikStorm
@BederikStorm 26 күн бұрын
I still use C whenever I can even when I code in C++. Yes, cin and cout are nice, but printf and scanf allow more easier
@noeldev
@noeldev 17 күн бұрын
@@BederikStorm Bro this is a joke, cuz if you do ++ it means + 1, i ain't arguing what's better lol
@JG_1998
@JG_1998 Жыл бұрын
If you are an engineer and plan to do anything related to software within engineering learning c++ is a must. Of course C is also important, but so much engineering work is done in C++. C is good for doing operating system related stuff and embedded systems.
@frankdearr2772
@frankdearr2772 Ай бұрын
Great topic, thanks 👍
@salamanetwork
@salamanetwork Жыл бұрын
C++ keeps amazing me everytime I have to code with it, New Syntax, New Features. I feel I don't know anything about programming at all everytime when I spending tim with it. Its fry my brain, but I love it.
@user-hb6ln3mq1d
@user-hb6ln3mq1d 4 ай бұрын
I'm a math and CS student. I've studied various languages such as Python, R, Bash, VBA, etc. When I first encountered C++, it intimidated me. Pointers were difficult to grasp, but at times, I found myself enjoying C++. When I contemplate computers or programs, my thoughts are expressed in C++.. Their power and elegance make me inclined towards C++. I'm young and still have a lot to learn, but I aspire to become a professional in C++. I don't exactly know why. Perhaps it's because C++ is elegant. Perhaps because my mind operates in C++.
@erik9817
@erik9817 4 ай бұрын
Nice comment! I feel that I have a hard time deciding between focusing on C++ and C#. I've spent some time learning C# but C++ has always been in the background, I was also intimidated at first, but I bought books about it several years ago.
@BrandyBalloon
@BrandyBalloon 12 күн бұрын
I can relate to this. My mind needs to have a deep understanding of how things work. When computers were simpler, I understood them at hardware level. You also need a hardware level understanding to effectively program microcontrollers. C and C++ are "close to the machine" and just suit the way my brain works. It's hard to explain exactly what that means to someone who doesn't think that way, but I completely understand what you're saying.
@xelaxander
@xelaxander Жыл бұрын
You made an error at 2:10. I think you meant C++ is a superset of C, not subset.
@isuckatthisgame
@isuckatthisgame Жыл бұрын
We programmers suck at talking :D
@archwizard_
@archwizard_ Жыл бұрын
Currently learning C++ (I come form a C# background). Love the language and I think it doesn't deserve the hate it receives. It's powerful, efficient & flexible.
@hecker230
@hecker230 10 ай бұрын
Can you recommend the resources for c++ ;)
@joaopedrovoga5497
@joaopedrovoga5497 10 ай бұрын
​@@hecker230 A good place to start would be a channel called "The Cherno", he offers a wide variety of C++ videos, but you will have to move on to other stuff later since he doesn't cover everything. I also recommend watching some C++ weekly videos from Jason Turner once you get more advanced. (I also recommend you learn C first) *Good luck!*
@erik9817
@erik9817 4 ай бұрын
Cool, I started with Java in uni and then became interested in C# but I’ve always had books about and interest for C++ for it’s efficiency and industry impact. I also like learning about backend development with .NET and C#. I’m having a really hard time deciding which one of these, C++ or C# to learn! I’m interested in topics like graphics, backend web dev, but even then, I have a hard time deciding!
@oscarsmith-jones4108
@oscarsmith-jones4108 3 ай бұрын
​​​@@erik9817 C++ is so important for your journey as a programmer. Even if you later learn a language unrelated to systems development, C++ gives you great insight into how to make more performant code. Other languages are also much easier after learning C++. Without learning pointers, for example, it can be harder to learn how all the objects connect together in C#. (C# has pointers called references, but they hide them). If you decide to go for a higher level language, try to not depend on a framework (like Unity) to learn the language. Otherwise you will be dependent on the framework and you won't learn how to structure the code on your own. C# is a really good language, but all programmers should learn C or C++ at some point imo to get a better understanding.
@aninosspro
@aninosspro 10 ай бұрын
Nice video as a C++ architecture you mention a lot of good points. but you forgot the buffer overflow runtime error
@RaigyoEcU
@RaigyoEcU Жыл бұрын
I usually code in Java/angular/R because of my job, but most of my personal projects are in c++, it's a wonderful languaje, and one that i would't like to forget
@MetalBansheeX
@MetalBansheeX 29 күн бұрын
What's your job?:3c
@milanmihailovic2113
@milanmihailovic2113 4 ай бұрын
There is only one real programming language C++, the rest are wrappers written in C++.
@whamer100
@whamer100 Жыл бұрын
i basically taught myself C++ and when starting college i took a class on it to further increase my skill, and its by far one of my favorite languages right now I basically use it as if it was C with bonus features (as how I personally feel it should be) I frequently mix the syntax where I see fit, using malloc for simple things like making a block of data to copy from a file into, and making a class or struct when I need something more complicated (specifically talking about C++ structs here) Its definitely not the best practice, but im just working on my own personal projects here, so its not like anyone other than me is going to be seeing it lmao
@xGOKOPx
@xGOKOPx Жыл бұрын
There's no reason to use malloc in C++ instead of new. Sometimes you may want to dynamically allocate a class that has a constructor, in which case new is the only way to do it properly. And using two different constructs to allocate memory throughout your program just adds mental overhead, instead of reducing it
@whamer100
@whamer100 Жыл бұрын
@@xGOKOPx I should've been more specific, I do use new most of the time
@myself50094
@myself50094 Жыл бұрын
@@whamer100 This is why rust is the leading programming language.
@whamer100
@whamer100 Жыл бұрын
@@myself50094 i should really learn rust tbh, the syntax annoyed me last time i tried it, but that was a couple years ago
@myself50094
@myself50094 Жыл бұрын
@@whamer100 i'm a troll
@ditz3nfitness
@ditz3nfitness 7 ай бұрын
Bjarne is the King. Went to the same University I currently are taking my degree in software engineering at! Second semester in!
@electricwizard1949
@electricwizard1949 Жыл бұрын
Learning both C and C++ for embedded systems in school. The question of which one was better came up and my teacher told us: "Mix and match. If you prefer something in C use it, if you prefer something in C++ use that instead. If it works, it's already a great stepping stone to see which one you'll prefer".
@ginxxxxx
@ginxxxxx 10 ай бұрын
the correct answer is neither
@pretro6136
@pretro6136 8 ай бұрын
every time i meet a beginer programmer, there's a 70% chance they want to learn c++. out of those 70%, only 10% actually use any c++ on the regular, and the rest of them either use it every once in a while or haven't even touched it in years.
@victorpinasarnault9135
@victorpinasarnault9135 Жыл бұрын
Man... C++ was my first programming language at college and even haven't saw the C programming language first! I always knew that learn C before C++ was the right way, but I saw less than the very basics because was only one semester.
@64bittz93
@64bittz93 11 ай бұрын
This is why I basically just write C, but use C++ classes and objects because they are super useful
@Briedys101
@Briedys101 4 ай бұрын
It is not just about classes and objects. Todays C++ standard library provides many useful features such as algorithms, threading, file system and much, much more. You don't have to reinvent a wheel and it is really fast. Even memory allocations if done right, you dont need to worry about releasing memory. Though you need to know how templates work :)
@recarsion
@recarsion Жыл бұрын
I worked in C for about 2 years in total and about 1 year in C++, and while both languages can be pains in the ass in their own ways, C++ was way more convoluted, unintuitive and tedious to work with in my experience. High-level, near-zero cost abstractions sound good but unless you can somehow solve memory safety without GC, you're building on sand. C++ couldn't quite achieve that, though many of its features and libraries are undeniably an improvement over C. Rust managed to do decades later what C++ couldn't back then. In conclusion, I wouldn't use C++ for any new project anymore unless I had no choice, like an Unreal game or a Qt application, though I wouldn't be surprised if both already have viable bindings in other languages.
@manasidixit9693
@manasidixit9693 5 ай бұрын
How much salary ? And does it make permanent
@georgehelyar
@georgehelyar Жыл бұрын
I just wish it were easier to interact with c++ shared libraries from other languages. I like overloads when just working in c++, for example, but then name mangling makes it hard to call some c++ code from something else, and I often have to write a c wrapper around a c++ library just to call it.
@mt-qc2qh
@mt-qc2qh 8 ай бұрын
I 1000% agree with your approach. I started my career in software with assembly language (many, many moons ago), learned C with K&R's first edition and now use C++ for a lot of simplification. Understanding the hardware level interaction before learning the higher level languages has made me a much better developer and debugger. After, a bit exaggerated millions of lines of commercial code, I still enjoy programming every day in retirement. Thank you for your insights!
@TimHinnerkHeuer
@TimHinnerkHeuer Жыл бұрын
I think C++ is very underrated. IMHO it's the best programming language that I know and I know more than 10 reasonably well. Its STL is a game changer for algorithmic programming. It's the best for competitive programming and makes you understand so many things much better. Maybe not everything should be written in C++ though. I use typescript and java on a daily basis but learning C++ fully made me understand so much more.
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 Жыл бұрын
Do you know Rust?
@BrandyBalloon
@BrandyBalloon 12 күн бұрын
I agree it's underrated. If I had to pick one language to be the most versatile, C++ is it. But it's terrible for some applications - web apps and data science for example.
@coolbrotherf127
@coolbrotherf127 Жыл бұрын
I've been studying it in college as most CS majors do and personally I found it to be a good language for learning low level programming as there are endless amounts of learning materials for it. The issue I have with it is the security risk that memory issues in the language has for actual production code. Rust and Carbon will probably finally cause C++ to become a legacy language like Colbol or Fortran. C++ is worth learning for now until Rust becomes the defacto low level systems language due to it being memory safe. Right more there are still a ton of C++ projects that need developers for them so if students learn it now, they can transition later.
@weirdo911aw
@weirdo911aw Жыл бұрын
Rust will probably become the "de facto" in 15 years. Python took 40 to be this popular
@shimadabr
@shimadabr Жыл бұрын
About C++ security, I think most of the common problems that Rust solved, C++ already did too. The problem is that while in Rust they're there by default (and you can't escape it), in C++ they're opt-in (but highly encouraged by the community) features or patterns, like smart pointers, RAII, ETC. Smart pointers are, in practice, C++ ownership system. C++ has a legacy of 30+ years, so a lot of legacy code and "legacy programmers" still use the old verbose, unsafe patterns.
@firstdingus
@firstdingus Жыл бұрын
I don't really think c++ will go away any time soon, since, at least on embedded devices, space is low and while a hello world in c++ or c takes up 20 kb or so, rust's hello world requires over 500 kb.
@v01d_r34l1ty
@v01d_r34l1ty Жыл бұрын
@@shimadabr finally somebody said it! Really when it boils down to it, Rust is better for new developers whereas C++ is more oriented toward experienced developers and toward more complex software. The industry only keeps programmers for about 4 years max (especially web) so it’s no wonder Rust is a major push right now. Rust is just safe C.
@v01d_r34l1ty
@v01d_r34l1ty Жыл бұрын
Carbon isn’t actually meant to replace C++, it’s meant to be an intermediary language. It’s weird.
@RazeVX
@RazeVX Жыл бұрын
its actualy a reasonable stance to say work your way from fundamentals to the top. but i feel if your first month your only shifing registers and memory allocation you wount be motivated to even try to get further. if i had not started with some iot projects that got me some feedback i dont think i would have had the motivation to go deeper.
@asdqwe4427
@asdqwe4427 Жыл бұрын
It was the first language we learned at university. For the better part of a year. I never looked back
@rod6722
@rod6722 Жыл бұрын
What would you recommend before learning Rust? Is learning C before Rust a good idea? Asking because I'm interested in learning Rust, seems like you can build some really cool stuff with it, and I'm familiar with C but only the very basics (basically what's covered in CS50). Otherwise I'm pretty comfortable coding in any high-level scripting language (JS, Python, Ruby, PHP, etc).
@jonatanalmen3647
@jonatanalmen3647 Жыл бұрын
You are set to go! Having done some coding in C and high level language is enough to get started!
@danielchettiar5670
@danielchettiar5670 Жыл бұрын
IMO if you've properly messed around with memory and know how you can really mess up without being careful with memory, then you can try learning Rust, you'll then appreciate what it tries to solve. So you're good. Try learning it
@0xTas
@0xTas Жыл бұрын
You can definitely jump in as you are right now, I was only marginally familiar with Python and Javascript when I started learning Rust (like ~5 months ago) and it's already my most comfortable and also favorite language to work in! Start reading through the book and don't give up when things get confusing! Rust has some concepts like lifetime annotations which won't be familiar to almost anyone at first but if you can push past those and the other low-level concepts that are new to you then you'll have access to one of the most pleasant languages to use imo, considering what it can offer.
@someonespotatohmm9513
@someonespotatohmm9513 Жыл бұрын
If you start out programming I would say rust because of the shooting yourself in the foot thing. If you are going to use it, whichever one best fits your purpose. The biggest difference between the 3 are the language features and syntax anyway.
@etopowertwon
@etopowertwon Жыл бұрын
Learning C will only hamper learning Rust. You can easily write in C++ as if it was C. If you try the same in Rust(and you will if you learn C first), borrow checker will crush you.
@diadetediotedio6918
@diadetediotedio6918 Жыл бұрын
I think the "As a coding language, C++ appeals to the ego, not the intellect" is an almost perfect statement
Жыл бұрын
Factually incorrect. Well used C++ is superior to C, or else mayor systems and most games would be written in C. No modern game is written in C, for a reason.
@rammyaly
@rammyaly Жыл бұрын
@ couldnt have said it better myself. i dont understand why C users love to shit on C++ so much 💀 Its like Tribemen hating on supersonic jets because it isnt made with sticks and tree sap
@MScienceCat2851
@MScienceCat2851 23 күн бұрын
You do not have to hate just because it is hard for you
@diadetediotedio6918
@diadetediotedio6918 23 күн бұрын
​@@MScienceCat2851 Except that I don't hate the language, I just despise the followers cult it have.
@MScienceCat2851
@MScienceCat2851 23 күн бұрын
@@diadetediotedio6918 Maybe you have point in that as I have seen people that have high ego using C++, but it is a real language when you go in world of programming where everything js not just print("hello")
@Fouissh
@Fouissh 6 ай бұрын
ok but what if I'm about to start my journey as programmist and my school teaches me c++ I don't have any experience with coding at all. Should I say f it and learn it anyways or do other languages first?
@Mrkenjoe1
@Mrkenjoe1 Жыл бұрын
My first project is updating a masm for dos 3.1 16bit. To 64 bit... I don't even know how to start but you seem to be a channel to look over to help me
@Ihavetoreturnsomevideotapes
@Ihavetoreturnsomevideotapes Жыл бұрын
3:07 Type safe? Or memory safe
@mRahman92
@mRahman92 Ай бұрын
Nice comments bro, makes everything that much clearer.
@GameShorts484
@GameShorts484 Жыл бұрын
c++ is not easily readable i think. c# is best for me. you understand almost everything when you start to read any c# file
@peperoni_pepino
@peperoni_pepino Жыл бұрын
My main issue with C++ (although I have only played around in it to try and mod games) is that I mainly learned to program in Python and I really take line 14 (and 15 lol) of the Zen to heart, while C++ just has too many parallel ways to do something. It is not obvious which way to use, and it seems that in the same code (e.g. the same game) different developers will use different ways to do essentially the same. Oh, and I have seen an open source software that both had a custom class Color and imported QColor, and mostly used QColor for colors that could update (user settings) and Color for fixed color, but there were exceptions. Why?!
@UsernameUsername0000
@UsernameUsername0000 4 ай бұрын
The latter isn’t a C++ issue though? It’s how that particular dev team decided to use other packages.
@erik9817
@erik9817 4 ай бұрын
Last paragraph: Probably to abstract away the use of QColor.
@JJSmalls
@JJSmalls Жыл бұрын
I'm reading Bjarne's book - "C++ Programming and Principles" and he recommends against learning C just to learn C++ afterwards.
@dimitris1988kom
@dimitris1988kom Ай бұрын
Is it a good book to learn C++ from?
@treeross
@treeross 9 ай бұрын
Idk a out doing C first. My intro to engineering course was in C and I was so lost the whole time. Same with VHDL in intro to EE. However I took something called "Progressive concepts for engineers" which was actually just "Learn C++" and I got 100% without much effort.
@peppebck
@peppebck 7 ай бұрын
this video is old but I'm a professional c++ programmer. I basically use C++ as a C plus the basic features I need. Once you can manage memory it's amazing what you can do. I try to not use too many different features so that my code remains very easy to read. that is crucial for me. I also program in c# and I love it but just where I don't have to push performance and memory management.
@noxagonal
@noxagonal Жыл бұрын
C++ is my favorite language. I also know C, C#, Python and couple more obscure ones. I like C++ for multiple reasons. It's deterministic unlike others; no hidden background operations like garbage collectors, it's low level when I need it and scales up to high level when I want stuff done, it's still the fastest language around when used properly, and I like its templates a lot. C++ has been evolving massively in the past 10 years making it faster and easier to use. The cons are that it comes with a lot of history.
@Dulge
@Dulge Жыл бұрын
Exactly, well said. People really taking away the low-level part and cry about the language because they come from languages like python and expect to breeze through it. C++ teaches you things you would never learn as a person who works only with very high-level languages, it really teaches you good programming practices, how the compiler works, OOP and just how to optimize your code
@noxagonal
@noxagonal Жыл бұрын
@@Dulge Thanks. Though I don't think C++ teaches good coding practices more than other languages either, or i didn't understand what you're saying. C# for example, does things differently but is pretty well structured. C++ is actually pretty relaxed in comparison to Rust. If people think C++ is hard then I do think C++ has problems in accessibility. I don't think it should be hard to use. C++ also has problems with usability. Eg. Static reflection...
@Dulge
@Dulge Жыл бұрын
@@noxagonal Yeah, i feel like the "hard" aspect is there for a reason however, if C++ was easy and we didn't need to do extra steps or have to understand pointers, references, OOP, virtual functions, inheritance, polymorphism and just a bunch of rules the language has then it wouldn't be powerful and used in nearly every engine, library or wherever programs and embedded systems need that performance and power
@Dulge
@Dulge Жыл бұрын
@@noxagonal As for the Rust being harder i personally would disagree, I think learning rust as a person familiar with another language makes it harder to learn then for a person who is brand new to programming because the way rust is. Mainly because of the legacy aspect C++ and most languages follow
@noxagonal
@noxagonal Жыл бұрын
@Dulge I probably shouldn't talk about Rust as I haven't used it on any actual project yet. I think we're approaching this from different perspectives. For example, if you try to use iterators in C++98 vs. C++20, you'll see what I mean. I think some basic knowledge about hardware is necessary in any compiled language, but even then, much of it could be abstracted in language level so that it still performs good. I think C++ could use a complete second standard library altogether, as complete as the current stl but without the history. Most game engines use stl minimally because it's ill suited for game development, though better nowadays, there are still many reasons to not use it. Easier, in this case, would be to have better utilities that we wouldn't need to write our own.
@keenoogodlike
@keenoogodlike 10 ай бұрын
If your boss tell you to use C++ or get fired, use C++. If it's your own project and you comfortable with (your choice), use whatever you like. They are tools to get job done. That's it.
@MrStetsonator
@MrStetsonator Жыл бұрын
thoughts on golang?
@TheMrKeksLp
@TheMrKeksLp Жыл бұрын
"The more general aim was to design a language in which I could write programs that were both efficient and elegant" Task failed successfully
@albertovelasquez9027
@albertovelasquez9027 Жыл бұрын
From my learning experience with C++, I would really like a C++ like language but whitout so many unnecesary features and obscure things.
@BrandyBalloon
@BrandyBalloon 12 күн бұрын
You don't have to use the unnecessary features and obscure things, but I guess the problem is when you have to work with code somebody else wrote.
@Spiderboydk
@Spiderboydk Жыл бұрын
I switched from C++ to C a few years ago and never regretted it. The main reason is C++ is so endlessly complex that takes a big cognitive toll in your head while developing. There is no such thing as not paying for features you don't use, because even if you don't use them, you still have to know about them and deal with them. You can't just ignore knowing about exceptions, move semantics, overload resolution, etc. C++ also likes to hide a lot of code from you in constructors, destructors, operator overloads, etc. so seemingly innocent statements like x = y + z; might execute all sorts of code from all over the code base. You really have to have a good knowledge of the code base to understand what's going on. It makes it hard to ballpark how fast or slow code might be. Switching to C freed up a lot of mental capacity I can now spend on actual problem solving.
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 Жыл бұрын
Going down to C is too far imo. Now you have to deal with poor typing capability and memory management (mistakes).
@Spiderboydk
@Spiderboydk Жыл бұрын
@@climatechangedoesntbargain9140 If you're sufficiently self-disciplined with the code you write, these are surprisingly minor issues. With a healthy mix of assertions, automated testing, static analysis, defensive programming, shunning "clever" code and using a good debugger, I spent very little time and effort on debugging.
@sososo3906
@sososo3906 Жыл бұрын
@@Spiderboydk but every time you will mess something up you will have to stop with the project and figure out the correct discipline instead of what you tried to do
@Spiderboydk
@Spiderboydk Жыл бұрын
@@sososo3906 I don't understand what you mean by "stopping with the project and figuring out the correct discipline". Are you talking about switching programming paradigmes?
@sososo3906
@sososo3906 Жыл бұрын
@@Spiderboydk i mean that in c you have a bug and forget about whatever you were doing because now you learn debugging, in rust the only fear is that you will have to learn lifetimes
@grzymsiu
@grzymsiu Жыл бұрын
I started programming lessons at my uni with c++ 98 and clean c. It was pain in the ass especially with pointers, but after getting it all, with the templates etc, when we hit later other languages like python it was effortless to learn it, and seemed like a toy for kids. So maybe it was a shock terapy like navy seal camp but it pays of.
@jamesmunroe6558
@jamesmunroe6558 8 ай бұрын
Re: caveat 2, "avoid sugar," it's not that features like iterators should be avoided, but that their appropriate use cases need to be properly understood so they can be used properly.
@vintagewander
@vintagewander Жыл бұрын
I think the scope creep is what makes C++ too broad in features and becoming quite a mess
@dynfoxx
@dynfoxx Жыл бұрын
For me it's that none of the features seem to mesh well together. They all seem separated and still in a first revision state. It just feels unfinished for some reason.
@hgbugalou
@hgbugalou Жыл бұрын
My introduction to computer programming in school was Visual Basic 4 in year 1 and then C++ in year 2. Granted this was the late 90s, but it was still a trial by fire and a lot of unlearning in the years after. I still like C++ though.
@justaway_of_the_samurai
@justaway_of_the_samurai 5 ай бұрын
I have used a lot of C++ for developing a video game engine. I can confidently say that C++ templates are Witchcraft. Remember: they are NOT the same as generics, which you would see in higher level languages, even though they look similar on the surface.A templated function is NOT a single function that takes a variety of arguments; it is a meta-function which generates multiple, isolated functions during compilation, with different memory locations.
@kevincmiles-cn6un
@kevincmiles-cn6un Жыл бұрын
2:58 Just curious, is there any advantage to having the "int i = 0;" before the for loop instead of inside the parentheses?
@LowLevelLearning
@LowLevelLearning Жыл бұрын
No real advantage, except declaring the variable inside the for loop scope wasn't valid C until C99
@FuzzhyFoo
@FuzzhyFoo Жыл бұрын
I don't think people have to learn C first. As a starting language, I think C++ contains a much simpler language trying to break free, chained down by legacy. I feel we scare away people from it by spooking them with scary concepts like pointers, references and memory safety. As though that is something exclusive to C/C++. If I were to introduce someone to programming through C++, I wouldn't teach them about raw memory allocation. No pointers, pointers to pointers, or even references. Reduce the friction between them and their code until it becomes relevant to understand the more core concepts. Let them pass variables by copy while they're learning. Move semantics have reduced the overhead of that dramatically. Let them return copies, they don't have to understand copy elision or NRVO. You don't teach someone java or C# by telling them how to appease the garbage collector. It's naive, yes. But even basic things in C can appear arcane. Take the supposedly safe "sprintf" - lovely name. You need to understand stack vs heap allocation, when to alloc/free. null terminators, the caveats of the sprintf family of functions, the 'safe' versions of them, what that strange 'restrict' keyword means, etc. Of course, there are nice, basic, declarative examples like adding strings together, which while basic, lets beginners appreciate how that happens under the hood.
@FuzzhyFoo
@FuzzhyFoo Жыл бұрын
Though, as a C++ developer, definitively try pure C at some point. There are a bunch of things you can learn to appreciate from it. It'll make you a better C++ developer for sure. Junior me's mind was blown realizing you could hide details in translation units. Or how often all you needed was some fixed size buffer/variable allocated on the stack.
@conrad9196
@conrad9196 Жыл бұрын
Greetings! I want to learn programming basics, final goal being able to develop my own tools in cibersecurity (malware analysis/development). I have roughly two years to dedicate to learn the basics, programming included. Could I ask for your opinion on how to structure a complete beginner study guide for not only programming in general but doing it in c++? What resources would you use? Any input is appreciated from an experienced and advanced user. Later on I will need python for automation, c#, powershell... But I could use a direction from zero level. Thank you in advance, sir
@FuzzhyFoo
@FuzzhyFoo Жыл бұрын
Don't you worry, I know what I'm talking about, and I know very well what you're talking about as well. I'm omitting parts to make a point. Details that also shouldn't matter to beginners. It's hardly a perfect language and never did I suggest it was. More experienced people are free to take educated decisions, and provide good reasoning for it. When it comes teaching people programming, I wouldn't say Ada would be my first pick.
@matyasmarkkovacs8336
@matyasmarkkovacs8336 Жыл бұрын
C is much simplier to understand and it takes less time to learn than C++. Pointers are really not a big deal if it is explained well to a beginner.
@alzon5712
@alzon5712 Жыл бұрын
Agreed, however I think the perception of pointers is they are somehow complicated, but they are not, its just a variable that holds the memory address to a value, to get the value you have to dereference the pointer first using * or -> and that's mostly it. To allocate a pointer you can use the new keyword, and to delete it delete. You don't delete it then it will stay in memory. When I have mentored beginners they picked this up quickly so I have no doubt someone with an aptitude for programming won't struggle too much then, once they are comfortable with that introduce them to smart pointers and tell them never to use raw pointers again lmao
@lonelytraveler8
@lonelytraveler8 Жыл бұрын
A lot of the code shown here is very dated, such as using begin() and end() to construct for-loops instead of range based, as one example. Compiling errors have come somewhat further, too. If you're stuck coding in a C++11 application, then fine, but it's over a decade old in a language that sees major adjustments every 3 years. Sadly, the main point almost applies MORE to modern C++, imo, so I guess it's a moot point...
@wrmusic8736
@wrmusic8736 4 ай бұрын
I love C++. std::vector, std::unordered_map, std::thread, smart pointers - great things. Save so much time, while offering a lot.
@walterreuther1779
@walterreuther1779 9 ай бұрын
2:11 "[C++] is a subset of C", didn't you mean SUPERset? Great video though! 😁
@IAmNotASandwich453
@IAmNotASandwich453 10 ай бұрын
I love C++, have been using for 10 years now and it is still my favorite language, but I get the feeling that some new features just feel "slapped on" and the language itself just kinda feels "outdated", like most features just get layered on top as an afterthought, which makes the syntax more confusing over the years.
@UsernameUsername0000
@UsernameUsername0000 4 ай бұрын
Mind giving an example? I can’t think of something that actively hurts readability other than templates and SFINAE - the latter of which is getting replaced with concepts (an evolution, not a devolution).
@huntabadday2663
@huntabadday2663 Жыл бұрын
Before I learned how to program, I started out learning and designing CPU architectures 4 years ago when I was 13 years old. I find that understanding how CPUs works to the logic level really helps with programing (And understanding pointers).
@31redorange08
@31redorange08 Жыл бұрын
0:12 The picture is correct, but I have no idea what you said there. His name is Bjarne Stroustrup.
@punditforka4960
@punditforka4960 9 ай бұрын
What is that color theme i love it
@NeiroYT
@NeiroYT Жыл бұрын
I love C++ for it's aesthetics, python looks oversimplified in this way. You feel exactly what your program will do, it's pretty useful. It may be hard to understand memory, pointers, addresses, but it's worth it.
@bmno.4565
@bmno.4565 Жыл бұрын
C++? Aesthetics? Come on bruh
@skittlesthehusky1225
@skittlesthehusky1225 Жыл бұрын
@@bmno.4565 u gotta admit c++ looks pretty cool ngl
@truth-12345.
@truth-12345. 4 ай бұрын
Hating C++ is more like a political view from almost everyone now. They should just start learning it.
@orangasli2943
@orangasli2943 Жыл бұрын
I tried to use pointer to object as a class's field but when trying to log out to console the pointer does not store accurate data..fed up with the difficulty just use object itself as class's field and copy the whole thing instead of copying memory address
@soadsam
@soadsam 7 ай бұрын
as someone new to programming a theme im starting to notice is it sounds like every programming language is hated by 90% of the population and the other 10% are the users
@Ma1ne2
@Ma1ne2 Жыл бұрын
I like C++. I love Rust. From my experience, learning C++ is difficult alone because it is so old and had so many changes. There are 10 ways to achieve something, often the new ways are better and easier. There is a good to great language hidden inside C++, a subset that is modern, comparably easy and safe to use . Then again, why hurt your brain by trying to find that language when you just can learn Rust that doesn't have the baggage of history and C compatibility.
@michaelmueller9635
@michaelmueller9635 Жыл бұрын
Just the whole CMake-Game and to figure out, what is outdated or not ...and if outdated is compatible with current CMake or if it's a dead end and deprecated.
@Ma1ne2
@Ma1ne2 Жыл бұрын
@@michaelmueller9635 Oh yeah, I so wanted to learn CMake and invested a lot of time in it. But it is not good, it is not easy to use, it is overcomplicated imo. Then the whole splitted ecosystem of librarier. Conan, Cmake, direkt Git, Microsoft's pkg or whatever the name was. No standardised way to do anything so you start at 0 with every new project. That's the thing with languages, it's not just the syntax, the performance i.e. the language itself. It is the build tools, the standard library, external library support and so much more. And if you view all of that together, developing C++ projects is just so exhausting. It is great for embedded stuff though because Arduino and PlatformIO did an amazing job at creating an ecosystem for all what's embedded for C++!
@heavymetalmixer91
@heavymetalmixer91 Жыл бұрын
Because of existing code, software and platforms that already use it, like games.
@exnihilonihilfit6316
@exnihilonihilfit6316 Жыл бұрын
@@heavymetalmixer91 Yep. Reason #1 in my opinion.
@kerim7158
@kerim7158 Жыл бұрын
You gotta understand that this is a very prolific and well-proven language. God knows how many machines, complicated infrastructures, embedded systems, compilers, operating systems as well as high-level systems are running on C++ at the moment. Probably billions. Does it have its problems? Yes, of course. Like any other language; C is so simple but it has very limiting features so you have to implement everything by yourself, python is so slow for performance critic systems, rust's compiler is so tight and it is hard to write rust code, etc. But these languages are also great and well-proven languages. So don't be biased like "Oh C++ sucks it is for egoist and narcissist people" it's just not the case. Use whatever language fits best for your project.
@nunyobiznez875
@nunyobiznez875 Жыл бұрын
C++ is a useful language, no doubt, and it has some features that I really like. But C++ may very well have terminal flaws now as well, that are growing. I think it may be going a bit far to say it's a "well proven language". It may have been well proven before 2011, but it's a dramatically changing language now. The thing I hate most about C++, and what I see as it's biggest flaw, is all of the redundant bloat and inconsistencies in the language, which only continues to grow exponentially. The language bloat is practically doubling in size, about every 3 years now, with no signs of slowing down. It's already like a 7-headed hydra, or more like a 7-headed python-hydra hybrid. How long before it's an usable mess, and new users aren't even able to learn the language? I don't know, but I do know that the current rate of growth isn't sustainable, and the people responsible for it, don't even seem to notice there's a problem. Just my two cents. I'm certain there are some who would disagree.
@kerim7158
@kerim7158 Жыл бұрын
@@nunyobiznez875 I agree C++ has a lot of features, some may say unnecessarily much that makes the language very complex. But the good news is you can always use a subset of C++ that you need, and you can always only use the features you think are useful. For example, if you don't like templates, don't use them. If you don't like functional programming features, fine, don't use them. And another good news is C++ is back-compatible (generally), so if C++11 is your style, you can use it. What I'm saying is, it is obvious that the language has some problems, but I can always find a lot of other problems in any given language. So these "Stop using C++" kinds of things are really overreactions.
@nunyobiznez875
@nunyobiznez875 Жыл бұрын
@@kerim7158 I have a bit of a love/hate relationship with C++, but just to be clear, I'm not saying people should stop using it, nor am I trying to overstate the case. The language has a lot of merits as well, but I'm guessing you're already well aware of them. I'm only stating concern, and it's mostly concern for the future of the language. But I do think this problem is a major contributing factor to a lot of the "Stop using C++" rhetoric, and as the problem grows, so to are the calls likely to grow. Your advice is good though, and it's mostly what I do. But avoiding features can only take a person so far as well, when needing to interface with someone else's code. So, I tend to try to adapt to the changes, even if I don't like all of them. But it can be a lot to keep up with. The solution really is just for the ISO board to be more thoughtful and careful with the language updates though, instead of throwing everything at the wall and seeing what sticks, then needing to release more features just to fix the mistakes and stuff that didn't quite work. Especially, since once it's in, stuff almost never gets removed. But, as I said, I really don't see the updates slowing down. I think they're overly concerned about being outdone by some shiny new feature in some other language though, and are paranoid of C++ being left behind. But maybe I'm wrong, and they have some other goal for continuing to bloat up the language.
@Basicguy1798
@Basicguy1798 10 ай бұрын
Yes templates when coupled with all its types, and other features of the lanaguge like passing a lambda to a template parameter of type std::function or etl::function(if you are in embedded domain) IS VERY difficult and annoying to read. But then there are good and bad programmers... I think what also matters is to know and understand how you can leverage what compiler optimizations are available. Make the code readable and maybe enable an optimization of -O3 in production code... code space reduced but code still readable
@anzar4142
@anzar4142 Жыл бұрын
Question: What you can do in C which you can't in c++ and vice versia, I need a real world example not like c++ have oop,pointer and other stuff, I want example for real world problem solving and if C can solve any problem then why should I learn c++
@MrZapper1960
@MrZapper1960 Жыл бұрын
The C++ standards committee is highly focused on making the language simpler and safer.. having an understanding of core facilities makes it mostly a pleasure to use in my experience. I cackle at those who say they just write c++ like c.. that indicates no effort to use it as intended.
Should you learn C++?? | Prime Reacts
20:29
ThePrimeTime
Рет қаралды 298 М.
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 6 МЛН
Monster dropped gummy bear 👻🤣 #shorts
00:45
Yoeslan
Рет қаралды 12 МЛН
Кәріс тіріма өзі ?  | Synyptas 3 | 8 серия
24:47
kak budto
Рет қаралды 1,6 МЛН
ШЕЛБИЛАР | bayGUYS
24:45
bayGUYS
Рет қаралды 596 М.
蜘蛛侠这操作也太坏了吧#蜘蛛侠#超人#超凡蜘蛛
00:47
超凡蜘蛛
Рет қаралды 48 МЛН
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 1,9 МЛН
The purest coding style, where bugs are near impossible
10:25
Coderized
Рет қаралды 829 М.
You don't need libraries to write a game engine in C++ | OpenGL | Devlog
2:50
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 707 М.
C is 50 Years Old. Should You Learn Rust?
5:14
Low Level Learning
Рет қаралды 243 М.
why do header files even exist?
10:53
Low Level Learning
Рет қаралды 338 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 730 М.
The Ultimate Tier Programming Tier List | Prime Reacts
26:57
ThePrimeTime
Рет қаралды 283 М.
Making a Game With C++ and SDL2
5:34
Goodgis
Рет қаралды 563 М.
Learning C++ by making a Game... in 1 Week?!
10:14
Floky
Рет қаралды 307 М.
M4 iPad Pro Impressions: Well This is Awkward
12:51
Marques Brownlee
Рет қаралды 6 МЛН
What % of charge do you have on phone?🔋
0:11
Diana Belitskay
Рет қаралды 304 М.
Добавления ключа в домофон ДомРу
0:18