C++ is like Lego. You can assemble the castle of your dreams, or you can scream in pain as you step on the pieces scattered on the floor
@filipanimations69672 жыл бұрын
Underrated comment
@SomeRandomPiggo2 жыл бұрын
@@filipanimations6967 dude its been 4 minutes lol
@FaZekiller-qe3uf2 жыл бұрын
@@filipanimations6967 it was only made 15 minutes ago, and is quite literally the highest rated comment.
@ferdam6662 жыл бұрын
stepping on lego is enjoyable.
@charlesriley27172 жыл бұрын
It's more like Playmobil
@helpfulprogrammer2 жыл бұрын
In C++ we don't say "Missing asterisk" we say "error C2664: 'void std::vector::push_back(const block &)': cannot convert argument 1 from 'std::_Vector_iterator' to 'block &&'"
@546dman2 жыл бұрын
😭
@SuperDraganco2 жыл бұрын
and I think it's beautiful
@mikeg9b2 жыл бұрын
That's one thing Rust has going for it: understandable error messages that usually tell you what to do to fix the problem.
@michalkotlicki47102 жыл бұрын
Understandable, have a great day
@kopuz.co.uk.2 жыл бұрын
@@mikeg9b That is an understandable error message though, Helpful programmer is trying to insert the wrong type into a vector.
@jomy10-games2 жыл бұрын
“We can get rid of this STD though” *listens carefully*
@CyberCat458 ай бұрын
It’s so fun to tell friends that c++ is full of stds
@EStartive6 ай бұрын
💀
@bluexo2566 ай бұрын
My youtube app literally translates this to "sexuell übertragbare Krankheiten" which is "sexual transferable disease" in german
@gabrielesalvatori68045 ай бұрын
@@bluexo256 yeah std is the acronym for sexual transmittable desease in english
@bluexo2565 ай бұрын
@@gabrielesalvatori6804 i know but i just thougt it's funny that my app actually spells it out like that when translating it
@UselessDuckCompany2 жыл бұрын
I'm about 2 weeks now in my journey of learning C++ and freeRTOS for programming some ESP32s, and from a JS/Python person POV it's a whole new perspective, you really feel like you are controlling a computer down to the bare metal for the first time. I think every programming enthusiast should try it. Especially with something like a microcontroller where you really need to care about the stack/heap and living inside of a few 100k of ram.
@bruh._.29112 жыл бұрын
i did the inverse thing, I started from c++ and now im learning JS. God JS is (at least for me ) "more caotic"
@amineabdz2 жыл бұрын
@@gabrielkennethmarinas6244 Because web dev and scripting is a lot more common and is easier than working with microcontrollers and kernels and game development.
@firstdingus2 жыл бұрын
Than try to program a 32 bit x86 assembly language bootloader. 😅
@Ali-ts8wn2 жыл бұрын
What app or website to learn these languages
@znation44342 жыл бұрын
How are you going about learning it? Starting from Python myself.
@dan2032 жыл бұрын
Couldn’t fit operator overloading into 100s? 😉 C++ is a huge language. I've been doing C++ professionally for 15 years and still learn new things all the time.
@manishtaker86222 жыл бұрын
It is one of the most fcked up things i have ever see and learnt but still get blown away by it🤣🤣
@sajibsrs2 жыл бұрын
You got me partner. Friend class and function, macros?! Ah... There are many of them.
@dan2032 жыл бұрын
@@sajibsrs macros aren’t even technically part of the C/C++ code, they're a feature of the compiler. But yet they’re so ubiquitous you'll need to learn those too. If you really want to melt your brain look into templates.
@ntrgc892 жыл бұрын
Yea and what about templates? SFINAE anyone?
@captainunicode2 жыл бұрын
@@ntrgc89 F*** SFINAE. It is so damn easy to f up with that. Thank heavens for concepts.
@Speglritz2 жыл бұрын
The benefits of unique pointers are not to only allocate something once, it's more about making sure a resource is only deallocated once as it will call the underlying objects destructor when it goes out of scope together with the fact that it can only have a single owner.
@sebastiangudino93772 жыл бұрын
It took me almost a decade of programing to have the knowledge to fully understand this sentence. It truly sounds like sci-fi giberish out of context
@marioc4852 жыл бұрын
Yes. I 100% agree.. What are we talking about?
@wiserdivisor2 жыл бұрын
Hello Asura! You seem to be really good with C++ and your channel has some hardware related stuff which also looks very cool. I am kind of new to the IT industry and I want to reach big boy level CPP along with hardware stuff that you have going there. wat do?
@fj12n32 жыл бұрын
Yeah that wasn't well explained
@CheatCodeSam2 жыл бұрын
C++ is honestly a pretty simple language as long as you’re taking advantage of smart pointers and other modern c++ features.
@AnoNymous-dh2sv2 жыл бұрын
C++ of 2022, is EXTREMELY different to C++ of 20+ years ago. Now it has extremely high level libraries on the DEFAULT spec so you can do things that any extremely high level language like python did by default (like text parsing) and I think if it had those features from the start dozens of popular languages would not even EXIST.
@drygordspellweaver8761 Жыл бұрын
Can you list the 10 best features of modern C++
@Db_BW Жыл бұрын
@@drygordspellweaver8761 I can mention some. Functions to convert strings to integers and vice-versa that were not existing. (2) Algorithms library that has like 100+ functionalities. (3) Boost library. (4) Lamba functions. (5) Modern Containers like sets, maps, and others. They are elegantly done and they are efficient too. (6) The std namespace has been immensely expanded through C++ 14, 17, and 20. You can check it out. There are so many new features that make C++ look really modern these days. One example is the array class. (7) Three-way comparison operator. (8) Coroutines
@drygordspellweaver8761 Жыл бұрын
@@Db_BW Thanks I appreciate it. I am not closed off to C++ as it is ubiquitous these days, but for sure I prefer oldschool C for it's elegance.
@yihan4835 Жыл бұрын
@@drygordspellweaver8761 smart pointers, move semantics, concurrency, lambda expressions, structured binding, concepts, uniform initialization, auto & decltype, range based for loop, fold expression.
@galdanith Жыл бұрын
@@drygordspellweaver8761 for some reason I can only see your replies, do you mind passing along that "best feature" list?
@ForTheOmnissiah Жыл бұрын
c++ having a string library means everything. Having done a course in Operating Systems that was C and that's it, having to manually write string manipulation functions was quite tedious. Not impossible or incredibly difficult, but felt like reinventing the wheel.
@dorgrosglick8234 Жыл бұрын
That's so true. I feel exactly the same!
@Pulko17211 ай бұрын
As someone who just started c++ and doesn't know what a string is, i agree!
@MohamedAhmed-le8mv10 ай бұрын
@@Pulko172 hey, I just started c++ 3 days ago. I bought a course on Udemy and doing it. haha any chance we can learn together?
@Je_suis_ton_pere10 ай бұрын
@@Pulko172 I hoped you learnt was a string was 4 week later
@marcsfeh4 ай бұрын
C++ std::string is extremely bad tho, no wonder Qt's string class is still preferred by a lot of people, even though it predates std::string
@mayanxoni2 жыл бұрын
The double colon operator (::) that's used to define functions outside the class is called the Scope Resolution Operator.
@swipefn1931 Жыл бұрын
using namespace really helps to not write those ::
@codewithjc4617 Жыл бұрын
@@swipefn1931Better not to ever use scoping directives, best to always specify full scope, or if necessary only use it at local scopes.
@AlwaysEast7 ай бұрын
Today I learned, tomorrow I'll forget. They will forever be Marvel's Celestial eyes.
@oraqlle2 жыл бұрын
It’s funny how, even with as much as you covered in as much detail as you can in 165 seconds, the language has evolved so much that discussing templates, lambdas, the ranges library and functional patterns in addition to everything you covered would mean anyone would have to go at “rap god” just to get through it all in the small timeframe. Relay impressed on the level of detail you did go to for this video. Excellent job, love your work! Looking forward to the next one.
@sophiacristina2 жыл бұрын
Omg, when i wanted to have fun programming on DOS with non-standard c++ from 1989... That is basically C... Really... You can see how much c++ changed if you use Borland turbo c++...
@BrotherCheng Жыл бұрын
I think just going through the more than dozen ways of initializing a variable in C++ these days will take more than 100 seconds.
@B1GTM4N2 жыл бұрын
My first, relatively big project I wrote in C++ was a Raytracer! Was (and still is) one of my most favourite projects to date! Awesome video as always, well written, spoken, and very informative! Thanks Jeff!
@EddEdw2 жыл бұрын
Oh, funnily, it was the same for me in 2014!!! Okay, it was only ray-casting, but to this day, I fondly remember the fun (really) I had when messing around with bit shifting. 😊
@mr.mirror12132 жыл бұрын
Hey man , I am trying to write a ray tracer but stuck at getting a good diffusion effect , any good resources?
@charlesm.26042 жыл бұрын
@@EddEdw You guys are nuts to find these fun worthy but god damn it's a flex
@sajibsrs2 жыл бұрын
Ah sounds easy :p
@klutch41982 жыл бұрын
hell yeah!
@ntrgc892 жыл бұрын
"using namespace std;" is kind of an anti-pattern. It's almost like saying "import *" in Python. You code becomes more terse, but now you can't tell if a keyword is builtin or from the namespace (or from the other namespace you 'used'/imported). And never put this in a header file, it'll hose anyone who includes your header.
@aap27642 жыл бұрын
but getting rid of stds is good and healthy
@acedev0032 жыл бұрын
Very valid fact here......
@ssholum2 жыл бұрын
C++ weekly learnt me out of that "using namespace" habit real quick with his explanation of it.
@climatechangedoesntbargain91402 жыл бұрын
@NerdCademy same, I just wtf every time I see this in tutorials - just why??
@jamesevans25072 жыл бұрын
@NerdCademy No one cares for a quick demo incels, have sex
@wojtekpolska10132 жыл бұрын
In school they showed us basics of a few different programming languages, and i think C++ was my personal favourite out of all of them, i hope to learn more of it in the future
@t0prar2 жыл бұрын
C++ was created as a superset of C but they have diverged since.
@Ovicron2 жыл бұрын
Oh absolutely. The general consensus in the cpp community is to avoid many of the vanilla C features which makes certain code unsafe.
@fallenIights2 жыл бұрын
Why
@02orochi2 жыл бұрын
@@fallenIights not a c++ programmer but its obvious that trying to be a Superset of c took a lotta baggage. Im sure c++ wouldve been much cleaner if it wasnt trying to be c with classes
@cypher39052 жыл бұрын
@@fallenIights Because you can do almost anything in C, including stuff that will break a program faster than anything else. C++ tends to be more secure and make it harder to do something stupid. Mixing old C and modern C++ is a good way to give you headache as they doesn't really have the same concepts anymore. C++ get rids of the low level heap allocation (and deallocation) which the source of most of the bugs in C programs. Not sure everything said above was english btw ....
@t0prar2 жыл бұрын
@@fallenIights C++ is a superset of C89/90 but since C99 things like variable length arrays and the restricted keyword have been introduced to C that are not present within C++. Why? Different committees make different decisions. 🤷
@Shiniiee2 жыл бұрын
Minor gripe: at 1:22, we don't call that the "bitwise shift left" in this context, but the stream insertion operator, or steam operator. Operators can be overloaded in C++, but people try to keep it "usual".
@chadgregory90372 жыл бұрын
and he called it double colon, not scope resolution operator!!!
@liambohl2 жыл бұрын
I was very confused when he called it a "bitwise shift left". For a second, I wondered if insertion had just been a shift this whole time, then I remembered writing my own insertion operators and realized my folly.
@keyboard_toucher2 жыл бұрын
He is "keeping it usual" by calling it the shift left operator. Given that it is overloadable, its meaning in any particular context could be anything, but its usual meaning is shift left, which is therefore the best name for the operator overall.
@NyscanRohid2 жыл бұрын
But it _is_ the bitwise left shift operator. You might not call it that, but many C++ programmers do. Bitwise operations are the original purpose of the shift operators. The only reason they're called stream operators after the fact is because the developers of std::iostream overloaded them for covenience.
@ruix2 жыл бұрын
You mean the less than sign?
@thehellberg2 жыл бұрын
You literally explained the Sololearn C++ course in a hundred seconds
@leoingson2 жыл бұрын
Hehe.
@klutch41982 жыл бұрын
I have actually taken that course and have the cert from it... haha!
@adenosinetp102 жыл бұрын
Hi Botfather!
@everythingtube1723 ай бұрын
I used to use sololearn, but the paywalls started getting bigger and bigger and then I stopped
@santoshmohanram5362 жыл бұрын
Most waited video. Very big fan for your work brother. Happy to see you explaining my favorite language C++. Keep Rocking brother
@zerxer79872 жыл бұрын
I didnt know programming languages had std's
@-Cocell5 ай бұрын
💀
@NNNedlog2 жыл бұрын
I was watching your "session vs turn authentication" when I got the video notification. Your videos are so helpful
@Futureblur2 жыл бұрын
Literally the same for me 😲
@charlesm.26042 жыл бұрын
@@Futureblur holly
@arshiaaghaei Жыл бұрын
A couple things to add: 1. C code is likely to not run on C++ compilers because of the fact that C++ doesn't consider some C keywords as valid (like restrict) 2. It's advised to avoid using namespace std and instead either use something like using std::cout or just using std::cout all the time.
@prodbykomrebi11 ай бұрын
also use ' ' instead of std::endl so it doesn't flush every newline
@arshiaaghaei11 ай бұрын
@@prodbykomrebi Yup I forgot to add this, even tho this should be fine outside loops
@KushalChandar.2 жыл бұрын
'
@Ovicron2 жыл бұрын
and '>>' extraction operator when used with std::cin.
@DrDemolition2 жыл бұрын
@@Ovicron weird naming convention cin-sertion and cout-sertion is way better 😂
@TheMR-7772 жыл бұрын
Well, I kinda prefer Bit-Shift Left, and Bit-Shift Right, as they make more sense, when you do actual Bit-Shifting
@igorswies59132 жыл бұрын
@@TheMR-777 it says "when used with cout"
@TheMR-7772 жыл бұрын
@@igorswies5913 Mmm, yeah, we “can” say. But I meant, although it's beginner-friendly, one may get to know the real term, when he/she will see the “actual” usage of that operator. It may confuse them at that point (as it did to me).
@kartikpatel39402 жыл бұрын
C++ has been one of my favourite languages ever since i learned it. Its blazing fast but sucks when it comes to cross platform apps you need to build code for every single architecture and every platform that your app support.
@SirSidi2 жыл бұрын
I heard someone asking about Java
@sophiacristina2 жыл бұрын
It is my fav language, i think that being such low-level and comprehensible for and high-level language is cool... Yes, it may have lot of things like come people criticize, but i think that is cool, every programmer can have a style and in fact, you can use it in a pretty simple way, because some basic commands are enough to mess with everything... I like python too, but i got so adapted to pointers that i have to reconfigure my brain when using python... I used to think those things were confusing until you get used to it and in fact it is super simple... Some logic is wrong? Having problem with objects and classes? Well, cast it as (char *) and f- it! Works like magic!
@climatechangedoesntbargain91402 жыл бұрын
It was for me, too. Until I discovered Rust
@sophiacristina2 жыл бұрын
@Glizzster That is another cool things about C++, since it is kinda old, there is lot of libs... Also, game and music, there is lot of c++ stuff... I think because speed and stuff...
@OConnelsSideOfDaRiver2 жыл бұрын
Java: "Am I a joke to you?"
@wearesciber2 жыл бұрын
I was explaining to my mom "Why C++" yesterday and then today you released this video! Perfect Timing!
@philmakesnoise5 ай бұрын
Man that's weird, I was just explaining it to your mom too.
@TheMR-7772 жыл бұрын
I've been mastering all the standards of C++, as it has become my favorite language! I love the Quote of Bjarne about Blowing the foot off :) So true,
@someshwartripathi84462 жыл бұрын
How? Can you give us an example?
@TheMR-7772 жыл бұрын
@@someshwartripathi8446 My perspective can be different, but it's somehow related to the people who criticize C++ :) As, I have seen many people (mostly unguided beginners, unfortunately) who start working in C++, and then get frustrated by the warnings and errors, which the compilers give (many times causing a cascade of errors). Instead, they start working in some higher level language, and the code just “runs”. They become happy, but when the code is used in real-time scenarios, they get badly failed. And it gets extremely difficult, and complicated to trace down that error, they made in their logic. Simply, we should always try to improve ourselves, optimize our logics, and only then compiler will help us grow along. Otherwise, you may have got the meaning of blowing the foot off :)
@alin11796 ай бұрын
Alright, I'm going to add C++ to my cv
@jacksontriffon50642 жыл бұрын
Fireship is pumping out quality videos extremely fast since hitting 1M subs 🔥 seriously insane. We're loving it, just don't burn yourself out 😁
@maxkratt2 жыл бұрын
Could you do Lua in 100 Seconds next, please?
@nullpointer17552 жыл бұрын
up
@tytywuu2 жыл бұрын
up
@_lod2 жыл бұрын
up
@nexusgaming92652 жыл бұрын
up
@robert192 жыл бұрын
up
@RemnantCult2 жыл бұрын
God bless my university for using this language as the first language you learn. It's like learning how to drive with a 12 gear semi.
@astralchan2 жыл бұрын
2:30 std::unique_ptr ptrJeff(new Human); When using the new keyword, allocate is still done to the heap like a normal pointer. Consider this instead: std::unique_ptr ptrJeff = std::make_unique(); Or, even: auto ptrJeff = std::make_unique(); This is especially important for shared pointers. For unique pointers, the only difference in the end is exception handling. Also, smart pointers need #include . Another thing to keep in mind is that these were added in c++11, so it might even be a good idea to specify. -std=c++11 or later.
@isodoubIet2 жыл бұрын
make_unique also allocates on the heap. There's no difference there. The main difference between using make_unique and unique_ptr(new x) is with exceptions: if you have an expression with two unique_ptr(new bla) subexpressions, the order of evaluation is unspecified which means you might run two "new"s and then the two unique_ptr constructions. If the second new throws an exception, the first one will leak. This may have been fixed with the evaluation order changes in c++17 but I don't see a point in risking it. make_unique also has a teachability benefit in that you can give a blanket guidelines like "never use the keyword new" and it'll be valid every time.
@astralchan2 жыл бұрын
@@isodoubIet Yes, they are also allocated to the heap. I mean that using new allocates without the ref counting / etc of smart pointers.
@awabqureshi8142 жыл бұрын
PERFECT TIMING I JUST STARTED LEARNING THIS YESTERDAY AND WAS CONFUSED
@Noah-vm8id2 жыл бұрын
I'm currently learning C++ in my internship (ok actually teach myself) and am really thankful for this video, really brought me some background infos
@codearmadillo2 жыл бұрын
std::cout > uses bitshift right. They are called Insertion operators.
@flyte98442 жыл бұрын
thanks for making advanced programming accessible to people with an average size brain like myself jeff , very cool !
This was my first introduction to programming. My parents signed me up for a free coding course, learning C++, and a quite rigorous one at that (homework and everything). I was in third grade. The result was what I can only describe as a mild form of PTSD, where I would cry every time I talked about how I didn't understand programming. This lasted for multiple years; only recently has that trauma worn off enough to where I can have an interest in programming again. And yes, typing that semicolon in the previous sentence was still painful.
@thorvaldspear2 жыл бұрын
@@schrayhu Actually, that's exactly what I've been doing. Needless to say, It's a breath of fresh air.
@S3Kglitches2 жыл бұрын
@@thorvaldspear starting programming with C++ is indeed a nice recipe for PTSD
@alipetuniashow2 жыл бұрын
@@S3Kglitches not necessarily, it can be good to start with it
@biqbicle4982 Жыл бұрын
@@S3Kglitches I've been doing C++ as my first language for 2 years and I can say very well after trying out multiple other languages, I love C++ the most!
@meceffeukada37672 жыл бұрын
I'm so glad I learned C and C++ basics in college before going after high level languages like Java, Python and JavaScript. Struggling with pointers, data structures and memory management makes other languages like a piece of cake, the only problem i faced was the different way of coding as in general coding in C and C++ is mostly procedural while with the languages i mentioned it's mostly POO + Functional
@KManAbout2 жыл бұрын
The other languages are only missing memory management.
@supernenechi2 жыл бұрын
@@KManAbout You mean languages like JS and Python? Aren't those expecting you to rely on garbage collectors? You're right that you as the programmer should care about memory management and not just leave it to something else
@KManAbout2 жыл бұрын
@@supernenechi I am saying that js and so on lack manual memory management. (go has pointers). Garbage collection is auto mem management. I think that it is unnecessary to manually manage memory in most circumstances. Garbage collection supports general programming practices by utilising DRY principles.
@KManAbout2 жыл бұрын
Every other problem in other languages persist like advanced data structures and like.
@BeastinlosersHD2 жыл бұрын
@@KManAbout hot take, been learning go for my upcoming internship and it makes me wanna die. It’s like someone made a proof of concept language and it got to popular.
@heavybladevideo6 ай бұрын
As someone who has been using the basics of C++ for a few years, I have no fucking clue what a class is.
@Rasa_b Жыл бұрын
I use C++ for embedded programs and algorithmic contests for speed only.it’s really hard to master but once you get a hang of it you will become unstoppable.Learning how to program in my opinion is like learning how to drive,first you learn it with manual transmission and after you have mastered it automatic transmission becomes second nature to you and you learn it faster.for programming you should start with a low level language like C++ (stay the f away from assembly) you will gain a lot of insight about how your program is interacting with hardware and after you learn that learning any other language will become easier and faster for you
@baconcake9492 жыл бұрын
Loving the 100s second series currently, could you do a sort of general Programming Vobulary in 100 seconds? I've noticed a lot of terms being used in a lot of these and I don't always know what they mean.
@HistoryinaNutshell-1Ай бұрын
your video helped me learn more on c++ than my collage lectures.
@Nicolas-jx3oo2 жыл бұрын
We live in a blessed area where technical subjects such as this one can be found explained as quick as this video and yet comprehensively Thank you so much
@zxnnightstalker22892 жыл бұрын
There are also, C++'s template Normal programming and meta programming. Operator overloading(any operator, with extra spaceship operator)
@nemeziz_prime2 жыл бұрын
Would love to see a full fledged Fireship course on C++ for beginners
@SkrekkLich2 жыл бұрын
Started learning programming with C++ 20 years ago by reading books. Will always be my secret love. Have to use C# at work. Nice video, on point!
@javabeanz85492 жыл бұрын
I took a college class about that time, was supposed to be C++, but we only got to see some actual C++ code in one project, it really turned out to be a C class.
@mohanaggarwal40582 жыл бұрын
C++ was my first programming language, and i loved❤️ it ever since.
@sophiacristina2 жыл бұрын
My first too and i basically just use it...
@Will_of_Iron2 жыл бұрын
Same here buddy 😊
@biqbicle4982 Жыл бұрын
@@Will_of_Iron c++ team Rise!
@rodarg2 жыл бұрын
Was looking for a C++ video on your channel yesterday, well here it is
@MrBomberman112 жыл бұрын
Would really love a video like this on VHDL or another lesser known language! Great vid as always!
@astralchan2 жыл бұрын
1:28 "... by adding [using namespace std] to the top of the file." It's generally considered bad practice to do this in the global scope.
@Schwein412 ай бұрын
Was about to say ..
@babaganaabba7852 жыл бұрын
I’ve never clicked on anything as fast as this 😂
@prashlovessamosa2 жыл бұрын
Mealso
@firstdingus2 жыл бұрын
Me to.
@haozhesun9522 жыл бұрын
Lmao truly the boss of the series
@yume69692 жыл бұрын
Same lol
@mmaagent88712 жыл бұрын
Click me
@oussamawahbi49762 жыл бұрын
"we can get rid of this STD" -Jeff Delaney 2022
@sankethb.k6422 жыл бұрын
I used to write C++ 3 years ago, and this video was nostalgic
@ggsap2 жыл бұрын
What do you write now? Did you switch?
@KMBatman2 жыл бұрын
Ye
@vintagewander2 жыл бұрын
same
@KMBatman2 жыл бұрын
@@vintagewander what do you write in now?
@cryptout Жыл бұрын
Don't forget Music, C++ is used in Synths (hardware and plugins) Audio effects and DAW's (Digital Audio Workstation).
@Tibor09912 жыл бұрын
I can feel the struggle of trying to cram every aspect of C++ in 100 seconds. Btw, "using namespace" and "new" mixed with smart pointers made me scream in pain.
@HypnosisBear2 жыл бұрын
Finally!! What I wanted! C++ in 100 seconds. Thx dude.
@mohanaggarwal40582 жыл бұрын
C++ is a wholesome bombshell, thats why u need to handle it carefully, if u not it will blow away ur whole leg.
@tannerted2 жыл бұрын
The statement that “Any valid C program is a valid C++ program” simply isn’t true. Many, but not all, things you do in C will work in C++. Also, don’t use “using namespace std” at the top of main. It is one of the cardinal sins of C++ development.
@FADHsquared2 жыл бұрын
I was looking for the "don't use `using namespace std`" comment, found it quick :P
@dderptrollz90732 жыл бұрын
@@FADHsquared wait why tho
@jonatanlind54082 жыл бұрын
@@dderptrollz9073 It's called namespace pollution. In short if you create a function with the same name as any function inside the standard linbrary it will at worst call the standard library instead of your own code and at best fail to compile due to ambiguity. The fact that the best case is compilation failure should tell you that bugs due to this behaviour are a nightmare to debug.
@amyshaw8932 жыл бұрын
@@jonatanlind5408 surely if you want to using std, then just dont make any functions that have the same name as a std function? you could make that argument for any using library, which makes the whole "using" thing pointless?
@gigachad68442 жыл бұрын
It is true, C++ is a superset of C
@jaymanx4life2 жыл бұрын
Ah, C++. First love. Without it I don't know if I learned any other languages. That's not to say it's bad; it's a really good stepping stone for new coders.
@powerdust015lastname42 жыл бұрын
I once started learning C++, but I quit shortly after that as all I knew about it was the annoying syntax like "cout " (was it cin? I don't remember). But now, after watching this video, C++ seems like a really nice language, so I'll give it another try... Thank you so much for all the regular high quality content!
@z01t4n2 жыл бұрын
I have never used C++, but if std::cout is standard character output, std::cin should be standard character input. Pretty straightforward if you ask me.
@yunggabel18452 жыл бұрын
cin is used to get character input from the console my guy
@someonestolemyname2 жыл бұрын
@@z01t4n I hate this form of syntax though, I think they were trying to make it easier to write format strings since you don't need to put all the variables at the back and it more resembles scripting languages that can replace variables in situ. But it makes the language look random and unstandardized, especially when you approach it like you do in C. I think some frameworks like Qt restored a more C like way of printing strings out, which I can't say if it is good or bad, but it certainly helped me.
@powerdust015lastname42 жыл бұрын
@@z01t4n it is... but it looked so strange as I typed it out XD
@DFPercush2 жыл бұрын
Yeah I always thought it was weird to overload the bitwise shift operator for stream insertion. It kind of makes sense, I guess, from a heuristic point of view, but it's not obvious to a beginner what's going on, that it's actually an overloaded operator. String interpolation would be really nice but I'm not sure it's possible given the existing syntax and the fact that strings are not technically part of the actual language. There's always stringstream, maybe they've constexpr-ified it by now, but it's still not quite as convenient as C# and js where you can just start typing code in the middle of a string literal.
@trofchik94882 жыл бұрын
Ok, I have couple gripes with this video. 1) Don't declare "using namespace std;" globally. It can cause ambiguities. 2) std::unique_ptr doesn't do what you say. Firstly, raw pointer is simply a variable that contains address to data of a certain type. int*, for example, points to date with type of int, char* to data with type of char, etc... std::unique_ptr is a wrapper over raw pointer that is deallocated on stack (at the end of {} block). When end of the {} block is reached destructor of class std::unique_ptr is being called which in turn calls destructor of an object the std::unique_ptr pointer was pointing at. When it comes to raw pointer only the variable that contains the address would be deallocated while data at said address would remain with no reference to access it (provided that data was created with "new" and assigned to pointer or created outside of this {} block). Now think of ICopyable in C#. Now imagine that this property is explicitly deleted inside std::unique_ptr class. That means that the pointer can no longer be passed by copy into anything thus guaranteeing that one and only one reference to given piece of data exists. If you still want to pass it around you can use std::move but it will null the pointer at place where you passed it from. Alternatively if you want to pass pointer to data around you can use std::shared_ptr which again is wrapper over raw pointer but it can be copied and atomically counts the amount of references to data across the program. Once the count reaches zero data is being deallocated.
@andrewrichesson86272 жыл бұрын
And this is why c++ is so deadly. You miss any of those steps, and you get a memory leak.
@kaosce2 жыл бұрын
@@andrewrichesson8627 Not really in the case of smart pointers, it will just not work ^^
@valizeth40732 жыл бұрын
@@andrewrichesson8627 If you code improperly, RAII makes it almost as easy to not get memory leaks as in a language with a garbage collector.
@climatechangedoesntbargain91402 жыл бұрын
@@valizeth4073 true, but you'll get a lot of dangling references anyway
@TheStickofWar2 жыл бұрын
It's a bit scary that I decided to finally start learning C++ for work so I can get involved in our open source code and then boom, you release a video.
@masnanang53052 жыл бұрын
my slogan: "It's hard to learn, have a confused day"
@yash11522 жыл бұрын
0:09 thanks a lot for correctly pronouncing his name, really, thanks a lot
@KuruGDI2 жыл бұрын
1:14 Hold it right there! The image is just rubbish! A keyboard is a input device (I agree on that), a touchscreen is both an input and output device (I also agree with this one) and a pair of headphones is an output device (of course it is) But why is a headset (not headphones) only an output device? How is a webcam an input and output device? The sorting makes very little sense. Sorry for getting stuck in such a minor detail... 😅 Other than that it's a good video 😀
@redstoneninja33752 жыл бұрын
You really did payed attention
@fant0m4072 жыл бұрын
Webcam maybe for the focus
@CodingWithLewis2 жыл бұрын
Amazing video as always!
@manuellernst37002 жыл бұрын
It would've been great if you mentioned that C++ can already be used in Web Dev with tools like Emcc. Great video anyway, just as all of your videos
@phil-gd6es2 жыл бұрын
But... why? It's the same blasphamy as node.js but in reverse, using an application language for web development.
@groszak12 жыл бұрын
@@phil-gd6es C++ renderers however can be much faster than HTML since instead of invoking bloated parsers and renderers you write only a few ints or so per frame which are native computational operations.
@Gisbert-128432 жыл бұрын
don't start using "using namespace std;", just get used to writing the namespace as well, it also deepens you relationship and natural understanding with/of them
@antiHUMANDesigns2 жыл бұрын
mmm, or type "using std::cout;" instead.
@a29stech332 жыл бұрын
Thanks, C/C++ will live forever!
@raghebbn54852 жыл бұрын
Man finally you uploaded a c++ in 100sec I've been waiting for it thanks man you are the best and keep going bro we are watching your back
@skylark.kraken2 жыл бұрын
``
@lior_haddad2 жыл бұрын
Well, just because it isn't used for bitwise shift left doesn't mean it isn't the bitwise shift left operator... If my class overrides the >= operator to work as a weird assignment operator, it doesn't stop it from being the "greater than or equal to" operator...
@skylark.kraken2 жыл бұрын
@@lior_haddad But the symbol already has a name, "output operator". If it didn't have a name then maybe you could call it "bitwise shift left operator" although that's muddying the waters because it doesn't do what that name is.
@charlesriley27172 жыл бұрын
Such a dumb way to output to terminal
@skylark.kraken2 жыл бұрын
@@charlesriley2717 I agree, one of the many annoyances and weird quirks resulting in why I don't touch C++ anymore (♥ Rust)
@alpers.21232 жыл бұрын
#include int main(){ std::printf("hi mom! "); return 0; }
@nerdastics39872 жыл бұрын
This guy just summarized my entire C++ experience: write small program, have it fail, rewrite it, have it fail 20 more times, then finally get it somewhat working. The language is very adaptive, but I had my first REEEEE when using it
@luizchagasjardim2 жыл бұрын
C++ is my favorite language of all time. I started doing programming videos on my channel last year and I planned to talk about C++, Rust, and others, but so far I've only managed to talk about C++ because there's so much to talk about.
@climatechangedoesntbargain91402 жыл бұрын
You'll never finish
@biqbicle4982 Жыл бұрын
@@climatechangedoesntbargain9140 stop demotivating him
@TranscendentBen Жыл бұрын
This is largely because there's this Official Committee that shoves in an almost-complete new language every three years. You want a home kitchen sink, an industrial kitchen sink, or a bathroom sink? We got it! Next revision is planning on a zero-gee sink. Know what a constraint is? Know what a concept is? These are things added to templates, which at least have been around since (almost?) the beginning of C++. Computer languages, especially C++, will eventually redefine every word in the English language.
@Megalcristo23 ай бұрын
It is amazing how every single line you wrote is actually deprecated, C++ evolves quite fast, although some people don't realize this
@OktatOnline Жыл бұрын
C++ has taken up much of my time in the past 3-4 months and I feel like I'm getting more and more addicted to it. I'm coming from a beginner Python background so.. steep learning curve, alright. Love it nevertheless!
@MaisTroll Жыл бұрын
what is your advice to learn cpp, did you just start creating projects and if so, what type of projects did you create?
@ThyTrueNightmare2 жыл бұрын
Very good overview, I think during uni the hardest part about it is our lecturers refused to teach us it
@0xchrisjones9932 жыл бұрын
Now that I have been in JS for a while, I really miss writing code in Cpp. Especially with libraries like Opengl or DirectX it was hella fun
@abdurequiem49192 жыл бұрын
Glad C++ was the first language I learned. It makes learning any other language easy since they're not as difficult to understand
@02orochi2 жыл бұрын
Well, most modern languages are closely related so thats why
@v_iancu2 жыл бұрын
1:27 Bad practice, global using directives cause name conflicts. If you want to omit the namespace prefix you can add local using directives where you need them
@oussamawahbi49762 жыл бұрын
It's never a bad practice to get rid of STDs
@pratiklondhe51672 жыл бұрын
@@oussamawahbi4976 lol
@charlesriley27172 жыл бұрын
Yeah I wasn't suprised Fireship didn't know that, he is a web developer so stupid cpp conventions are never prevelant.
@mrocto3292 жыл бұрын
@@charlesriley2717 I know Fireship does these videos with care, but I feel his videos are feeling more and more rushed as time passes. I notice many bad practices or straight up bad code in his examples, making the languages look bad. I've also been paying attention to the community and I feel this is just feeding the Javascript community's ego (As in, they are slowly thinking Javascript is the only sane language when there are many AMAZING languages out there!).
@threepointonefour6072 жыл бұрын
This entire video was a bit of a disaster. `
@RapFab2 жыл бұрын
Sry if it's a bit off, I'm not that into the programming scene (yet) and as an outsider I just have to say that the "We can get rid of this std though" made me chuckle at least a little bit
@barmetler2 жыл бұрын
God I love that language. Probably my favourite language of them all. Template meta programming, compile time programming, operator overloading, rvalue references, const qualified functions, the idea of moving/copying, destructors, smart pointers, sfinae, references and pointers, and did I mention templates? Coolest language there is. Period. It might seem daunting at first. But I promise, once you fully understand everything about the language, it's one of the most fun programming experiences you can have.
@The_Ostrich Жыл бұрын
How long does it take to understand "everything" or at least get good enough so you can program meaningful things? I spend the last 3 days trying to figure out what variables are and how to implement them in the code and just now started to understand it.
@barmetler Жыл бұрын
@@The_Ostrich haha my comment is a little out of date by now, I haven't looked into the latest developments. But for me, I took a course in uni, which just gave me enough tasks, topics, and inspiration to actually do a lot of research. One of the most important things to do imo is reading source code. Go into the standard library and see what they're doing, and if you find something you don't understand, Google that specific concept. This guided me through concepts like templates, template specializations, sfinae, fold expressions, or more abstract concepts like raii, perfect forwarding, or features like destructuring, variants, operator overloading, the list goes on. It's a very long list to be honest... By knowing "everything" I think I meant that I could answer any question, or at the very least know enough to quickly look up missing details.
@barmetler Жыл бұрын
@@The_Ostrich I would say, try to implement actual small projects. Like a tuple class, a quick hard-coded parser, or more homeworks tasks like I guess a fake filesystem. When it comes to template meta programming, you will most likely start with factorial, Fibonacci, etc, but later on it won't just be arithmetic expressions.
@The_Ostrich Жыл бұрын
@@barmetler Yes, but how long does it take to understand "everything" or at least get good enough so you can program meaningful things?
@barmetler Жыл бұрын
@@The_Ostrich that course I took was one semester, so like 5 months
@richtigmann12 жыл бұрын
It came out right as I was getting into C++! I was waiting for this one!
@rohandas62982 жыл бұрын
Curiosity brought me here.
@mastcharub71772 жыл бұрын
Finally!! I love you! can you make also ASM x86-64, Batch and OrbitDB?
@oncedidactic2 жыл бұрын
Okay, literally this video should be at the beginning of every CS course progression. It has everything you need to get started, in 2:45.
@climatechangedoesntbargain91402 жыл бұрын
No, it teaches using using....
@elliott81752 жыл бұрын
I know this was only 100 seconds, but templates are a truly essential part of the language, while inheritance is mostly discouraged (rarely worthwhile compared to the age-old composition). Templates allow for compile-time polymorphism for great abstraction at zero cost (zero run-time cost, that is - it has a high compile-time cost that's somewhat improved in Modules, added in c++20). The next major feature of the language would be template meta-programming.
@jameyd9162 жыл бұрын
I hate to do the " BUT AKSUALLY", but anyway: C++ isnt a strict superset of C, not all C programs run under a C++ compiler. inheritance isn't a zero-overhead abstraction. It definitely has an overhead.
@DFPercush2 жыл бұрын
It depends on whether you're using virtual functions. If the types are all known at compile time then it costs nothing to call a superclass function on a subclass object. Templates are also purely compile time abstractions, although they do increase the binary size if you're counting that.
@dietznuts4014 Жыл бұрын
Bravo, you basically went through everything you go through in intro to CS for C++ and very well!
@tanishqagarwal54962 жыл бұрын
C++: Do I leak memory and am unsafe? Rust: You have always been
@pshr24472 жыл бұрын
cringe
@Ovicron2 жыл бұрын
Tell me you know nothing about the language, without telling me you know nothing about the language.
@raianmr28432 жыл бұрын
very cringe, pls delet
@cptegonbr1402 жыл бұрын
only transformers code rust, you are one of them
@valizeth40732 жыл бұрын
Nah, in terms of leakage C++ is just as safe as Rust, just that Rust moved RAII to a language level rather than something that C++'s kept on a library level (apart from the core principle of destructors that enables RAII to begin with).
@hasinaramanandraitsiory3647 Жыл бұрын
This is a golden content. I swear if you got some programming background just by watching the video you could do a lot of stuff hahah
@InstantlyEdits2 жыл бұрын
Suggestion: Make a video about Node.js C++ Addons!
@jackwalker29472 жыл бұрын
STL ( Standard Template Library) is a gem 💎 in C++, Using CPP , for more than 2 years.
@valizeth40732 жыл бұрын
Not to be that guy, but it's "stdlib"*. STL hasn't been a thing since the early 90's (if we ignore the fact that microsofts implementation of stdlib is called STL but that's rarely what people refer to).
@anashashim2 жыл бұрын
Great 100 seconds for my favorite language ever! There's a minor mistake, you don't really need to #include to use the string type. I'd say the compiler includes it with iostream, but not sure. Including it is a good practice though.
@petrustefanescu58422 жыл бұрын
The preprocessor, not the compiler, includes libraries. Also, he had done right to include string library, because not everywhere in your C++ programs you use iostream
@valizeth40732 жыл бұрын
There's no guarantee that it will as there's no guarantee from the standard that it must do it. So yes, you *should most definitely* include if you use std::string. Same goes for everything else, include what you use.
@isodoubIet2 жыл бұрын
There's lots of mistakes in this video lol, some fairly major.
@gamaray6136 Жыл бұрын
For two minutes you managed to fit a decent amount of core language features, I have to say
@cipherxen22 жыл бұрын
C and C++ are the language for engineers. Not for weak of heart.
@theterribleanimator17932 жыл бұрын
and for masochists, but thats besides the point.
@salsamancer2 жыл бұрын
@@theterribleanimator1793 C is for masochists, C++ is for masochists with multiple personality disorder
@cipherxen22 жыл бұрын
You both must be python script kiddies
@theterribleanimator17932 жыл бұрын
@@cipherxen2 c++ was my first language, i'm better at it than any other language i write in as i've practised for years. I know it a language for masochists because unless you are working with embedded systems or high performance applications it is unnecessary, and something like python is preferable for its easy to use nature and readability. Hows your web-dev job going? React is causing you some headache?
@cipherxen22 жыл бұрын
@@theterribleanimator1793 you say you practised for years but I don't think so. Only a below average programmer would think C++ is for masochists. It's very bold of you to think I'm only a web developer. I mainly work on low level projects (that's how I know the power of C and C++). I also do web dev using angular, C#, Java. React is too idiotic for my liking.
@-TheBugLord2 жыл бұрын
Templates are something that C++ has that are so useful. You can make a class or function able to run for a multitude of types.
@valentin68242 жыл бұрын
Stuff like that are only template-basics. Have you worked Sith Variadic Templates or Template template Parameters? 😂
@-TheBugLord2 жыл бұрын
@@valentin6824 Yes I have. And that ties directly into what I was saying.
@lgamer51332 жыл бұрын
The explosion effect always gets me🤣
@chfr2 жыл бұрын
Would've loved for the video to go "we can get rid of this std though, by adding a namespace at the top of the file" "and then we get rid of this namespace and bring std back in after we get yelled on by users on stackoverflow"
@v000172 жыл бұрын
Using namespace std is something that will bite you eventually. Unique_ptr is a great idea but always prefer the std::make_unique initialization.
@blackfowl752 жыл бұрын
Why should we use std::make_unique instead of a "normal" initialization?
@cptegonbr1402 жыл бұрын
@@blackfowl75 it frees the memory when its not used anymore ( out of scope )
@v000172 жыл бұрын
@@blackfowl75 make_unique is more concise, avoiding repeating the type. It also safely handles exceptions where using `new` in the constructor may leak memory if an exception occurs.
@DFPercush2 жыл бұрын
There are performance reasons as well. make_unique and make_shared construct the object in place, rather than creating a temporary object and then having to move or copy it. The arguments to make_shared are the same as the constructor for that class. This also applies to emplace_back and emplace_front in various containers, as opposed to push_back or push_front which will have to move/copy the object. smart pointers will still delete the memory if you assign a raw pointer to them, as they own that pointer now. But as Votlu points out, there might be a leak if there's an exception between your "new" and the return of make_unique. You also have to be sure you're not using that raw pointer any more after you give ownership to the smart pointer.
@valizeth40732 жыл бұрын
@@cptegonbr140 That's not what make_unique does. The actual deletion of the resources is handled by the deleter you specify to the unique_ptr (which by default just invokes 'delete') in the destructor. make_unique is used for constructing a unique_ptr in an exception safe way.
@Reeces_Pieces2 жыл бұрын
Where was this video when i was in University? They taught us Java 1st and then C++ they taught us during data structures.
@donno20482 жыл бұрын
"Virtually any C program is also a valid C++ program" The following code will compile with no errors or warnings on C but it has five errors on C++: #pragma GCC diagnostic ignored "-Wint-conversion" int main() { int namespace, bool; // and more void (*f)(); f(0); char string[4] = "text"; void *v; int *num; num = v; return v; }
@joshuaevans43012 жыл бұрын
Keyword: "Virtually" 🙄
@zprestige12 жыл бұрын
You should make videos for each big programming language to show what its used for and what you can make with it and some ideas