C++ in 100 Seconds

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 19. 06. 2024
  • C++ or C-plus-plus or Cpp is an extremely popular object-oriented programming language. Created in 1979, today it powers game engines, databases, compilers, embedded systems, desktop software, and much of our software infrastructure.
    #programming #compsci #100SecondsOfCode
    🔗 Resources
    Microsoft Docs docs.microsoft.com/en-us/cpp/
    Bjarne Stroustrup Homepage www.stroustrup.com/
    C in 100 Seconds ‱ C in 100 Seconds
    C# in 100 Seconds ‱ C# in 100 Seconds
    đŸ”„ Get More Content - Upgrade to PRO
    Upgrade to Fireship PRO at fireship.io/pro
    Use code lORhwXd2 for 25% off your first payment.
    🎹 My Editor Settings
    - Atom One Dark
    - vscode-icons
    - Fira Code Font
    🔖 Topics Covered
    - What is C++?
    - C++ basics tutorial
    - Who invented C++?
    - What is C++ used for?
    - What is a smart pointer?
    - C++ vs C
    - Object oriented programming basics
  • Věda a technologie

Komentáƙe • 1,8K

  • @ShortHax
    @ShortHax Pƙed 2 lety +21424

    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

    • @filipanimations6967
      @filipanimations6967 Pƙed 2 lety +335

      Underrated comment

    • @SomeRandomPiggo
      @SomeRandomPiggo Pƙed 2 lety +567

      @@filipanimations6967 dude its been 4 minutes lol

    • @FaZekiller-qe3uf
      @FaZekiller-qe3uf Pƙed 2 lety +247

      @@filipanimations6967 it was only made 15 minutes ago, and is quite literally the highest rated comment.

    • @ferdam666
      @ferdam666 Pƙed 2 lety +96

      stepping on lego is enjoyable.

    • @charlesriley2717
      @charlesriley2717 Pƙed 2 lety +12

      It's more like Playmobil

  • @helpfulprogrammer
    @helpfulprogrammer Pƙed 2 lety +11495

    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 &&'"

    • @546dman
      @546dman Pƙed 2 lety +607

      😭

    • @SuperDraganco
      @SuperDraganco Pƙed 2 lety +1462

      and I think it's beautiful

    • @mikeg9b
      @mikeg9b Pƙed 2 lety +695

      That's one thing Rust has going for it: understandable error messages that usually tell you what to do to fix the problem.

    • @michalkotlicki4710
      @michalkotlicki4710 Pƙed 2 lety +314

      Understandable, have a great day

    • @kopuz.co.uk.
      @kopuz.co.uk. Pƙed 2 lety +212

      @@mikeg9b That is an understandable error message though, Helpful programmer is trying to insert the wrong type into a vector.

  • @jomy10-games
    @jomy10-games Pƙed 2 lety +714

    “We can get rid of this STD though”
    *listens carefully*

    • @CyberCat45
      @CyberCat45 Pƙed 4 měsĂ­ci

      It’s so fun to tell friends that c++ is full of stds

    • @EStartive
      @EStartive Pƙed 2 měsĂ­ci +3

      💀

    • @blauesaxolotl
      @blauesaxolotl Pƙed 2 měsĂ­ci +27

      My youtube app literally translates this to "sexuell ĂŒbertragbare Krankheiten" which is "sexual transferable disease" in german

    • @gabrielesalvatori6804
      @gabrielesalvatori6804 Pƙed měsĂ­cem +2

      @@blauesaxolotl yeah std is the acronym for sexual transmittable desease in english

    • @blauesaxolotl
      @blauesaxolotl Pƙed měsĂ­cem +4

      @@gabrielesalvatori6804 i know but i just thougt it's funny that my app actually spells it out like that when translating it

  • @dan203
    @dan203 Pƙed 2 lety +4289

    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.

    • @manishtaker8622
      @manishtaker8622 Pƙed 2 lety +182

      It is one of the most fcked up things i have ever see and learnt but still get blown away by itđŸ€ŁđŸ€Ł

    • @sajibsrs
      @sajibsrs Pƙed 2 lety +60

      You got me partner. Friend class and function, macros?! Ah... There are many of them.

    • @dan203
      @dan203 Pƙed 2 lety +141

      @@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.

    • @ntrgc89
      @ntrgc89 Pƙed 2 lety +31

      Yea and what about templates? SFINAE anyone?

    • @samuelmahler5961
      @samuelmahler5961 Pƙed 2 lety +8

      @@ntrgc89 F*** SFINAE. It is so damn easy to f up with that. Thank heavens for concepts.

  • @UselessDuckCompany
    @UselessDuckCompany Pƙed 2 lety +4001

    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._.2911
      @bruh._.2911 Pƙed 2 lety +166

      i did the inverse thing, I started from c++ and now im learning JS. God JS is (at least for me ) "more caotic"

    • @amineabdz
      @amineabdz Pƙed 2 lety +271

      @@gabrielkennethmarinas6244 Because web dev and scripting is a lot more common and is easier than working with microcontrollers and kernels and game development.

    • @firstdingus
      @firstdingus Pƙed 2 lety +53

      Than try to program a 32 bit x86 assembly language bootloader. 😅

    • @Ali-ts8wn
      @Ali-ts8wn Pƙed 2 lety +2

      What app or website to learn these languages

    • @znation4434
      @znation4434 Pƙed 2 lety +5

      How are you going about learning it? Starting from Python myself.

  • @Zex-4729
    @Zex-4729 Pƙed 2 lety +1279

    C++ is my first language and it's really fun to learn. It also made learning other languages very easy.

    • @thomasdecorail8825
      @thomasdecorail8825 Pƙed rokem +24

      If you could start over, would you learn Python instead ?

    • @alexanderangelkov6338
      @alexanderangelkov6338 Pƙed rokem +87

      In my uni we have mandatory courses for introduction in programming, object oriented and data structures all in c++ You learn the lower level and then all the other languages that are higher level feel dumb lol

    • @v01d_r34l1ty
      @v01d_r34l1ty Pƙed rokem +14

      @@alexanderangelkov6338 we do java at my uni :((

    • @felipebrunetta2106
      @felipebrunetta2106 Pƙed rokem +94

      @@o_sch Yes. Roblox studio. The main factor in picking a language

    • @electrorakan5894
      @electrorakan5894 Pƙed rokem +9

      i'm planning to start with c++ and go for java after ( maybe JS after java ) but mainly i'm planning to start with c++ and java after it is that good ?

  • @Speglritz
    @Speglritz Pƙed 2 lety +920

    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.

    • @sebastiangudino9377
      @sebastiangudino9377 Pƙed 2 lety +100

      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

    • @marioc485
      @marioc485 Pƙed 2 lety +30

      Yes. I 100% agree..
      What are we talking about?

    • @wiserdivisor
      @wiserdivisor Pƙed 2 lety +2

      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?

    • @fj12n3
      @fj12n3 Pƙed 2 lety +5

      Yeah that wasn't well explained

    • @CheatCodeSam
      @CheatCodeSam Pƙed 2 lety +34

      C++ is honestly a pretty simple language as long as you’re taking advantage of smart pointers and other modern c++ features.

  • @AnoNymous-dh2sv
    @AnoNymous-dh2sv Pƙed 2 lety +237

    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
      @drygordspellweaver8761 Pƙed rokem +4

      Can you list the 10 best features of modern C++

    • @Db_BW
      @Db_BW Pƙed 10 měsĂ­ci

      @@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
      @drygordspellweaver8761 Pƙed 10 měsĂ­ci +8

      @@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
      @yihan4835 Pƙed 9 měsĂ­ci

      @@drygordspellweaver8761 smart pointers, move semantics, concurrency, lambda expressions, structured binding, concepts, uniform initialization, auto & decltype, range based for loop, fold expression.

    • @dylanalpers
      @dylanalpers Pƙed 8 měsĂ­ci

      @@drygordspellweaver8761 for some reason I can only see your replies, do you mind passing along that "best feature" list?

  • @ntrgc89
    @ntrgc89 Pƙed 2 lety +1398

    "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.

    • @aap2764
      @aap2764 Pƙed 2 lety +369

      but getting rid of stds is good and healthy

    • @acedev003
      @acedev003 Pƙed 2 lety +2

      Very valid fact here......

    • @ssholum
      @ssholum Pƙed 2 lety +37

      C++ weekly learnt me out of that "using namespace" habit real quick with his explanation of it.

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 Pƙed 2 lety +32

      @NerdCademy same, I just wtf every time I see this in tutorials - just why??

    • @jamesevans2507
      @jamesevans2507 Pƙed 2 lety +10

      @NerdCademy No one cares for a quick demo incels, have sex

  • @ForTheOmnissiah
    @ForTheOmnissiah Pƙed rokem +106

    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
      @dorgrosglick8234 Pƙed 8 měsĂ­ci +4

      That's so true. I feel exactly the same!

    • @Pulko172
      @Pulko172 Pƙed 6 měsĂ­ci +1

      As someone who just started c++ and doesn't know what a string is, i agree!

    • @MohamedAhmed-le8mv
      @MohamedAhmed-le8mv Pƙed 5 měsĂ­ci

      @@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_pere
      @Je_suis_ton_pere Pƙed 5 měsĂ­ci +1

      @@Pulko172 I hoped you learnt was a string was 4 week later

  • @B1GTM4N
    @B1GTM4N Pƙed 2 lety +598

    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!

    • @EddEdw
      @EddEdw Pƙed 2 lety +9

      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.mirror1213
      @mr.mirror1213 Pƙed 2 lety +3

      Hey man , I am trying to write a ray tracer but stuck at getting a good diffusion effect , any good resources?

    • @charlesm.2604
      @charlesm.2604 Pƙed 2 lety +43

      @@EddEdw You guys are nuts to find these fun worthy but god damn it's a flex

    • @sajibsrs
      @sajibsrs Pƙed 2 lety

      Ah sounds easy :p

    • @klutch4198
      @klutch4198 Pƙed 2 lety

      hell yeah!

  • @mayanxoni
    @mayanxoni Pƙed 2 lety +239

    The double colon operator (::) that's used to define functions outside the class is called the Scope Resolution Operator.

    • @swipefn1931
      @swipefn1931 Pƙed rokem +7

      using namespace really helps to not write those ::

    • @codewithjc4617
      @codewithjc4617 Pƙed rokem +7

      @@swipefn1931Better not to ever use scoping directives, best to always specify full scope, or if necessary only use it at local scopes.

    • @AlwaysEast
      @AlwaysEast Pƙed 3 měsĂ­ci +1

      Today I learned, tomorrow I'll forget. They will forever be Marvel's Celestial eyes.

  • @oraqlle
    @oraqlle Pƙed 2 lety +672

    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.

    • @sophiacristina
      @sophiacristina Pƙed 2 lety +9

      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
      @BrotherCheng Pƙed rokem +12

      I think just going through the more than dozen ways of initializing a variable in C++ these days will take more than 100 seconds.

  • @t0prar
    @t0prar Pƙed 2 lety +461

    C++ was created as a superset of C but they have diverged since.

    • @Ovicron
      @Ovicron Pƙed 2 lety +86

      Oh absolutely. The general consensus in the cpp community is to avoid many of the vanilla C features which makes certain code unsafe.

    • @fallenIights
      @fallenIights Pƙed 2 lety +4

      Why

    • @02orochi
      @02orochi Pƙed 2 lety +76

      @@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

    • @cypher3905
      @cypher3905 Pƙed 2 lety +81

      @@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 ....

    • @t0prar
      @t0prar Pƙed 2 lety +70

      ​@@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. đŸ€·

  • @thehellberg
    @thehellberg Pƙed 2 lety +286

    You literally explained the Sololearn C++ course in a hundred seconds

    • @leoingson
      @leoingson Pƙed 2 lety +4

      Hehe.

    • @klutch4198
      @klutch4198 Pƙed 2 lety +15

      I have actually taken that course and have the cert from it... haha!

    • @adenosinetp10
      @adenosinetp10 Pƙed 2 lety +3

      Hi Botfather!

  • @KushalChandar.
    @KushalChandar. Pƙed 2 lety +128

    '

    • @Ovicron
      @Ovicron Pƙed 2 lety +27

      and '>>' extraction operator when used with std::cin.

    • @DrDemolition
      @DrDemolition Pƙed 2 lety +19

      @@Ovicron
      weird naming convention
      cin-sertion and cout-sertion is way better 😂

    • @TheMR-777
      @TheMR-777 Pƙed 2 lety +5

      Well, I kinda prefer Bit-Shift Left, and Bit-Shift Right, as they make more sense, when you do actual Bit-Shifting

    • @igorswies5913
      @igorswies5913 Pƙed 2 lety +9

      @@TheMR-777 it says "when used with cout"

    • @TheMR-777
      @TheMR-777 Pƙed 2 lety +1

      @@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).

  • @santoshmohanram536
    @santoshmohanram536 Pƙed 2 lety +71

    Most waited video. Very big fan for your work brother. Happy to see you explaining my favorite language C++. Keep Rocking brother

  • @wojtekpolska1013
    @wojtekpolska1013 Pƙed 2 lety +26

    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

  • @Shiniiee
    @Shiniiee Pƙed 2 lety +354

    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".

    • @chadgregory9037
      @chadgregory9037 Pƙed 2 lety +31

      and he called it double colon, not scope resolution operator!!!

    • @liambohl
      @liambohl Pƙed 2 lety +8

      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_toucher
      @keyboard_toucher Pƙed 2 lety +12

      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.

    • @NyscanRohid
      @NyscanRohid Pƙed rokem +18

      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.

    • @ruix
      @ruix Pƙed rokem +4

      You mean the less than sign?

  • @Noah-vm8id
    @Noah-vm8id Pƙed 2 lety +3

    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

  • @maxkratt
    @maxkratt Pƙed 2 lety +126

    Could you do Lua in 100 Seconds next, please?

  • @MrBomberman11
    @MrBomberman11 Pƙed 2 lety +8

    Would really love a video like this on VHDL or another lesser known language! Great vid as always!

  • @kartikpatel3940
    @kartikpatel3940 Pƙed 2 lety +204

    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.

    • @SirSidi
      @SirSidi Pƙed 2 lety +12

      I heard someone asking about Java

    • @sophiacristina
      @sophiacristina Pƙed 2 lety +20

      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!

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 Pƙed 2 lety +14

      It was for me, too.
      Until I discovered Rust

    • @sophiacristina
      @sophiacristina Pƙed 2 lety +2

      @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...

    • @OConnelsSideOfDaRiver
      @OConnelsSideOfDaRiver Pƙed 2 lety +2

      Java: "Am I a joke to you?"

  • @jacksontriffon5064
    @jacksontriffon5064 Pƙed 2 lety +23

    Fireship is pumping out quality videos extremely fast since hitting 1M subs đŸ”„ seriously insane. We're loving it, just don't burn yourself out 😁

  • @NNNedlog
    @NNNedlog Pƙed 2 lety +57

    I was watching your "session vs turn authentication" when I got the video notification. Your videos are so helpful

  • @baconcake949
    @baconcake949 Pƙed 2 lety +8

    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.

  • @rodarg
    @rodarg Pƙed 2 lety

    Was looking for a C++ video on your channel yesterday, well here it is

  • @dietznuts4014
    @dietznuts4014 Pƙed rokem

    Bravo, you basically went through everything you go through in intro to CS for C++ and very well!

  • @awabqureshi814
    @awabqureshi814 Pƙed 2 lety +4

    PERFECT TIMING I JUST STARTED LEARNING THIS YESTERDAY AND WAS CONFUSED

  • @zerxer7987
    @zerxer7987 Pƙed 2 lety +21

    I didnt know programming languages had std's

    • @-Cocell
      @-Cocell Pƙed měsĂ­cem

      💀

  • @ewwitsantonio
    @ewwitsantonio Pƙed 2 lety

    OOooo I've been hoping you'd do C++! Awesome! Thanks so much for these great videos.

  • @raghebbn5485
    @raghebbn5485 Pƙed 2 lety

    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

  • @TheMR-777
    @TheMR-777 Pƙed 2 lety +21

    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,

    • @someshwartripathi8446
      @someshwartripathi8446 Pƙed 2 lety +4

      How? Can you give us an example?

    • @TheMR-777
      @TheMR-777 Pƙed 2 lety +7

      @@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 :)

  • @syedmubazir4371
    @syedmubazir4371 Pƙed 2 lety +11

    2:40
    Compiler Error - > Syntax Error
    Expected ' ; ' near ".
    😂😂

  • @richtigmann1
    @richtigmann1 Pƙed 2 lety +1

    It came out right as I was getting into C++! I was waiting for this one!

  • @flyte9844
    @flyte9844 Pƙed 2 lety +37

    thanks for making advanced programming accessible to people with an average size brain like myself jeff , very cool !

  • @NikNacLegend
    @NikNacLegend Pƙed 2 lety +3

    Thanks for making this fireship. I'm currently learning c++ so this has been a real help 👍

  • @meceffeukada3767
    @meceffeukada3767 Pƙed 2 lety +184

    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

    • @KManAbout
      @KManAbout Pƙed 2 lety +1

      The other languages are only missing memory management.

    • @supernenechi
      @supernenechi Pƙed 2 lety

      @@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

    • @KManAbout
      @KManAbout Pƙed 2 lety +7

      @@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.

    • @KManAbout
      @KManAbout Pƙed 2 lety +1

      Every other problem in other languages persist like advanced data structures and like.

    • @BeastinlosersHD
      @BeastinlosersHD Pƙed 2 lety +9

      @@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.

  • @christrifinopoulos8639
    @christrifinopoulos8639 Pƙed měsĂ­cem +1

    thank you I watched this video and build my own compiler with the knowledge I gained

  • @thorvaldspear
    @thorvaldspear Pƙed 2 lety +53

    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.

    • @thorvaldspear
      @thorvaldspear Pƙed 2 lety +1

      @@schrayhu Actually, that's exactly what I've been doing. Needless to say, It's a breath of fresh air.

    • @S3Kglitches
      @S3Kglitches Pƙed 2 lety +5

      @@thorvaldspear starting programming with C++ is indeed a nice recipe for PTSD

    • @alipetuniashow
      @alipetuniashow Pƙed rokem

      @@S3Kglitches not necessarily, it can be good to start with it

    • @biqbicle4982
      @biqbicle4982 Pƙed rokem

      @@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!

  • @astralchan
    @astralchan Pƙed 2 lety +22

    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.

    • @isodoubIet
      @isodoubIet Pƙed rokem

      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.

    • @astralchan
      @astralchan Pƙed rokem

      @@isodoubIet Yes, they are also allocated to the heap. I mean that using new allocates without the ref counting / etc of smart pointers.

  • @KonradGolinski
    @KonradGolinski Pƙed 2 lety +2

    I love your videos ;) I suggest making a video about embedded software - in ATMs, arcade machines, GPS, etc.
    Also one about Windows Embedded would be great

  • @m1ch4l28
    @m1ch4l28 Pƙed 2 lety

    Currently I'm creating a presentation about Object Oriented Programming and C++.
    I was wondering why you didn't cover this popular language yet.
    A few days later I watch this video - perfect timing I guess! :D

  • @nemeziz_prime
    @nemeziz_prime Pƙed 2 lety +6

    Would love to see a full fledged Fireship course on C++ for beginners

  • @0xchrisjones993
    @0xchrisjones993 Pƙed 2 lety +6

    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

  • @ThyTrueNightmare
    @ThyTrueNightmare Pƙed 2 lety +2

    Very good overview, I think during uni the hardest part about it is our lecturers refused to teach us it

  • @hunter_bs463
    @hunter_bs463 Pƙed 11 měsĂ­ci

    Good overview, I just started learning the language so it helps to understand the concepts

  • @TheOriginalJohnDoe
    @TheOriginalJohnDoe Pƙed 2 lety +5

    "A class is just a blueprint for an object". Gosh that's the best concise explanation I've ever heard.

  • @zxnnightstalker2289
    @zxnnightstalker2289 Pƙed 2 lety +6

    There are also,
    C++'s template Normal programming and meta programming.
    Operator overloading(any operator, with extra spaceship operator)

  • @slimaloui920
    @slimaloui920 Pƙed 2 lety

    Thank you so much for your work ! You are an inspiration for me !

  • @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

  • @Nicolas-jx3oo
    @Nicolas-jx3oo Pƙed 2 lety +24

    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

  • @RemnantCult
    @RemnantCult Pƙed 2 lety +13

    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.

  • @xanthe69
    @xanthe69 Pƙed 2 lety +1

    The video I wanted for so long, thanks dude

  • @isaiahehli2357
    @isaiahehli2357 Pƙed 18 dny

    Amazed for the detail of explanation in so little time!

  • @wearesciber
    @wearesciber Pƙed 2 lety +3

    I was explaining to my mom "Why C++" yesterday and then today you released this video! Perfect Timing!

    • @philmakesnoise
      @philmakesnoise Pƙed 27 dny

      Man that's weird, I was just explaining it to your mom too.

  • @KaSSa__
    @KaSSa__ Pƙed 2 lety +7

    Been working with C++ and Qt for about 5 years. Please send help.

  • @zprestige1
    @zprestige1 Pƙed 2 lety +1

    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

  • @jakubmichalenko7990
    @jakubmichalenko7990 Pƙed 2 lety +2

    Great video, cause I have been recently learning c++ because I’m trying to switch from c#, I have absolutely no problem with C# I just want to get on lower level.

  • @oussamawahbi4976
    @oussamawahbi4976 Pƙed 2 lety +10

    "we can get rid of this STD" -Jeff Delaney 2022

  • @babaganaabba785
    @babaganaabba785 Pƙed 2 lety +25

    I’ve never clicked on anything as fast as this 😂

  • @HypnosisBear
    @HypnosisBear Pƙed 2 lety +2

    Finally!! What I wanted! C++ in 100 seconds. Thx dude.

  • @ieatgarbage8771
    @ieatgarbage8771 Pƙed 11 měsĂ­ci +1

    the > used for cout and cin aren't bitshifts. They just happen to use the same symbol as a bitshift because symbols are scarce.

    • @n0ame1u1
      @n0ame1u1 Pƙed měsĂ­cem

      Actually, the standard refers to those symbols as "bitwise left shift" and "bitwise right shift". Specifically see the table on the "arithmetic operators" page in cppreference, which gives the general names of the operators.
      But yes, people do also often call them the stream output and stream extraction operators.

  • @mohanaggarwal4058
    @mohanaggarwal4058 Pƙed 2 lety +5

    C++ is a wholesome bombshell, thats why u need to handle it carefully, if u not it will blow away ur whole leg.

  • @v_iancu
    @v_iancu Pƙed 2 lety +40

    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

    • @oussamawahbi4976
      @oussamawahbi4976 Pƙed 2 lety +23

      It's never a bad practice to get rid of STDs

    • @pratiklondhe5167
      @pratiklondhe5167 Pƙed 2 lety +5

      @@oussamawahbi4976 lol

    • @charlesriley2717
      @charlesriley2717 Pƙed 2 lety +1

      Yeah I wasn't suprised Fireship didn't know that, he is a web developer so stupid cpp conventions are never prevelant.

    • @mrocto329
      @mrocto329 Pƙed 2 lety +3

      @@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!).

    • @threepointonefour607
      @threepointonefour607 Pƙed 2 lety +3

      This entire video was a bit of a disaster. `

  • @mastcharub7177
    @mastcharub7177 Pƙed 2 lety +1

    Finally!! I love you! can you make also ASM x86-64, Batch and OrbitDB?

  • @codearmadillo
    @codearmadillo Pƙed 2 lety +2

    std::cout > uses bitshift right. They are called Insertion operators.

  • @astralchan
    @astralchan Pƙed 2 lety +6

    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.

  • @Luke_UPPX
    @Luke_UPPX Pƙed 2 lety +22

    Great video đŸ”„
    I learned C ++ at university and still believe it's the father of all modern languages. If you're able to program in C ++ then you can program in all languages

    • @mainkt9212
      @mainkt9212 Pƙed 2 lety +8

      Not really

    • @Luke_UPPX
      @Luke_UPPX Pƙed 2 lety +5

      @@mainkt9212 have you ever programmed data structures and algorithms in C++? You don't know what you say

    • @tanned_cosines_
      @tanned_cosines_ Pƙed 2 lety +1

      agreed

    • @somenamelastnaammee52
      @somenamelastnaammee52 Pƙed 2 lety +3

      @@Luke_UPPX based

    • @tanned_cosines_
      @tanned_cosines_ Pƙed 2 lety +1

      @@Luke_UPPX stl to rescue 🛐
      the only reason not to study DS in C lol

  • @festivebear9946
    @festivebear9946 Pƙed rokem

    Really like your work man. Just took a course in C++ and this video really did good in condensing all that information and more. I was wondering though, what are you using to quickly fill in your code? I see you're not even typing, just stuff is appearing that seems faster than any ctrl+c ctrl+v I've seen.

  • @Rasa_b
    @Rasa_b Pƙed 9 měsĂ­ci +2

    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

  • @mohanaggarwal4058
    @mohanaggarwal4058 Pƙed 2 lety +10

    C++ was my first programming language, and i loved❀ it ever since.

  • @tannerted
    @tannerted Pƙed 2 lety +127

    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.

    • @FADHsquared
      @FADHsquared Pƙed 2 lety +41

      I was looking for the "don't use `using namespace std`" comment, found it quick :P

    • @dderptrollz9073
      @dderptrollz9073 Pƙed 2 lety +2

      @@FADHsquared wait why tho

    • @jonatanlind5408
      @jonatanlind5408 Pƙed 2 lety +17

      @@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.

    • @amyshaw893
      @amyshaw893 Pƙed 2 lety +1

      @@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?

    • @gigachad6844
      @gigachad6844 Pƙed 2 lety +1

      It is true, C++ is a superset of C

  • @kanzanaveed
    @kanzanaveed Pƙed 2 lety +1

    I have learned & written C++ for 3 semesters and this video feels so satisfying in some way nostalgic too đŸ˜¶đŸ’›

  • @CodingWithLewis
    @CodingWithLewis Pƙed 2 lety +2

    Amazing video as always!

  • @precumming
    @precumming Pƙed 2 lety +22

    ``

    • @lior_haddad
      @lior_haddad Pƙed 2 lety +1

      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...

    • @precumming
      @precumming Pƙed 2 lety +3

      @@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.

    • @charlesriley2717
      @charlesriley2717 Pƙed 2 lety +1

      Such a dumb way to output to terminal

    • @precumming
      @precumming Pƙed 2 lety +1

      @@charlesriley2717 I agree, one of the many annoyances and weird quirks resulting in why I don't touch C++ anymore (♄ Rust)

    • @alpers.2123
      @alpers.2123 Pƙed 2 lety

      #include
      int main(){
      std::printf("hi mom!
      ");
      return 0;
      }

  • @abdosoliman
    @abdosoliman Pƙed 2 lety +3

    My favorite language of all time 😍😍😍. it's just so good when you actually use it properly. it will take quite a while to get there but god damn it's worth it

  • @Danielle-ew1el
    @Danielle-ew1el Pƙed měsĂ­cem

    i admire your work ethic and your dedication to your channel! 

  • @shreechatane9215
    @shreechatane9215 Pƙed 2 lety +2

    I have been a cpp coder for a long time , can feel the vibe ^ _ ^

  • @arshiaaghaei
    @arshiaaghaei Pƙed 9 měsĂ­ci +5

    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.

    • @prodbykomrebi
      @prodbykomrebi Pƙed 7 měsĂ­ci +3

      also use '
      ' instead of std::endl so it doesn't flush every newline

    • @arshiaaghaei
      @arshiaaghaei Pƙed 7 měsĂ­ci +1

      @@prodbykomrebi Yup I forgot to add this, even tho this should be fine outside loops

  • @manuellernst3700
    @manuellernst3700 Pƙed 2 lety +9

    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-gd6es
      @phil-gd6es Pƙed 2 lety +2

      But... why? It's the same blasphamy as node.js but in reverse, using an application language for web development.

    • @groszak1
      @groszak1 Pƙed rokem +1

      @@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.

  • @siddharthchhetry4218
    @siddharthchhetry4218 Pƙed 2 lety

    Since i understand little bit of c++ and c its has been fun to watch

  • @thomasgipson7120
    @thomasgipson7120 Pƙed 2 lety

    I adore c++. You can anything you want to with it as long as you have the skill to pull it off. Wonderful language.

  • @sankethb.k642
    @sankethb.k642 Pƙed 2 lety +19

    I used to write C++ 3 years ago, and this video was nostalgic

    • @ggsap
      @ggsap Pƙed 2 lety +1

      What do you write now?
      Did you switch?

    • @KMBatman
      @KMBatman Pƙed 2 lety +1

      Ye

    • @vintagewander
      @vintagewander Pƙed 2 lety +1

      same

    • @KMBatman
      @KMBatman Pƙed 2 lety +1

      @@vintagewander what do you write in now?

  • @trofchik9488
    @trofchik9488 Pƙed 2 lety +24

    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.

    • @andrewrichesson8627
      @andrewrichesson8627 Pƙed 2 lety

      And this is why c++ is so deadly. You miss any of those steps, and you get a memory leak.

    • @kaosce
      @kaosce Pƙed 2 lety +5

      @@andrewrichesson8627 Not really in the case of smart pointers, it will just not work ^^

    • @valizeth4073
      @valizeth4073 Pƙed 2 lety

      @@andrewrichesson8627 If you code improperly, RAII makes it almost as easy to not get memory leaks as in a language with a garbage collector.

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 Pƙed 2 lety

      @@valizeth4073 true, but you'll get a lot of dangling references anyway

  • @kelvinrawson1729
    @kelvinrawson1729 Pƙed 2 lety +1

    That was a cool video, now I'm waiting for C++ 20 in 100 sec ;)

  • @siddhantkhare2775
    @siddhantkhare2775 Pƙed 2 lety +1

    I wanted this video from you since 2-3 Months.....Thanks For Uploading.....
    Btw, Love from India Bro....🇼🇳🇼🇳🇼🇳

  • @WhohateAmerica
    @WhohateAmerica Pƙed 2 lety +4

    I thought the video would be something like: "It is literally impossible to describe and C++ concept in a more or less undersandable fashion in just 100 secs, so please enjoy the remaining 95 secs of this nice Lo-Fi music. Thank you!"

  • @jaymanx4life
    @jaymanx4life Pƙed 2 lety +19

    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.

  • @parthg199
    @parthg199 Pƙed 2 lety +1

    Waited for my first programmijg language for so long :)

  • @TheStickofWar
    @TheStickofWar Pƙed 2 lety +1

    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.

  • @InstantlyEdits
    @InstantlyEdits Pƙed 2 lety +6

    Suggestion: Make a video about Node.js C++ Addons!

  • @Tibor0991
    @Tibor0991 Pƙed 2 lety +3

    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.

  • @brolveth4470
    @brolveth4470 Pƙed 2 lety

    Was kind of waiting for it since it was my first language because of school

  • @gamaray6136
    @gamaray6136 Pƙed rokem

    For two minutes you managed to fit a decent amount of core language features, I have to say

  • @v00017
    @v00017 Pƙed 2 lety +18

    Using namespace std is something that will bite you eventually.
    Unique_ptr is a great idea but always prefer the std::make_unique initialization.

    • @blackfowl75
      @blackfowl75 Pƙed 2 lety

      Why should we use std::make_unique instead of a "normal" initialization?

    • @cptegonbr140
      @cptegonbr140 Pƙed 2 lety

      @@blackfowl75 it frees the memory when its not used anymore ( out of scope )

    • @v00017
      @v00017 Pƙed 2 lety

      @@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.

    • @DFPercush
      @DFPercush Pƙed 2 lety

      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.

    • @valizeth4073
      @valizeth4073 Pƙed 2 lety

      @@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.

  • @robert6315
    @robert6315 Pƙed 2 lety +4

    Your videos are amazing! Can you do a video on Solidity?

    • @klusmo
      @klusmo Pƙed 2 lety +4

      there is already a 100 seconds on Solidity, and a few other videos on web3

    • @Luukth
      @Luukth Pƙed 2 lety +1

      He made one already, check his channel!

    • @robert6315
      @robert6315 Pƙed 2 lety

      @@klusmo really? can you send me a link here

    • @robert6315
      @robert6315 Pƙed 2 lety

      nevermind i found it a while ago forgot to update the comment

  • @nopenot-happening9074
    @nopenot-happening9074 Pƙed 2 lety

    Just as I was wondering where this was! Nice

  • @bryan6090
    @bryan6090 Pƙed 2 lety

    fireship
    seriously wtf . I was litterly deciding on a back end language to learn . That was my goal for the day.... Thank you

  • @lgamer5133
    @lgamer5133 Pƙed 2 lety +4

    The explosion effect always gets međŸ€Ł