The "auto" keyword in C++

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ม.ค. 2025

ความคิดเห็น • 264

  • @andrefaustino5514
    @andrefaustino5514 2 ปีที่แล้ว +37

    TIP: In current MVS2022, if you double click left ctrl, the inferred type will be displayed between auto and the name. It's a great tool for those who really wants to know the type of the variable but also wants a cleaner code. It's like you can alternate between inferred type and explicit type with one button.

    • @wang_7665
      @wang_7665 2 ปีที่แล้ว +9

      That's why I love this series so much. Firstly learned from the video itself, then learned from comments to grab new features.

    • @yousefbilal4837
      @yousefbilal4837 ปีที่แล้ว +6

      This has been updated to alt+f1 instead of double ctrl in newer versions

  • @LucidStew
    @LucidStew 6 ปีที่แล้ว +39

    Even though it got a bit off topic, I like the "you could do this, you could do that" part with using and typedef while explaining the use of auto to do something similar.

  • @Blure
    @Blure 4 ปีที่แล้ว +41

    I'll be spending the next few weeks watching your videos and brushing up my C++ skills. Thanks for sharing your knowledge!

    • @MuletTheGreat
      @MuletTheGreat 9 หลายเดือนก่อน

      How did you brushing up?

  • @theguywhoiscoding9912
    @theguywhoiscoding9912 6 ปีที่แล้ว +305

    you can simplify the for-loop even more to:
    for (auto &string : strings)
    readability over 9000

    • @emilianzawrotny367
      @emilianzawrotny367 5 ปีที่แล้ว +49

      It is better to do for(const auto &string : strings)

    • @Alberto-ez4lr
      @Alberto-ez4lr 4 ปีที่แล้ว +18

      @@qatarking2498 means that you are using a reference of a string instead of making a copy of each string object for each iteration, that's would be so inefficient.

    • @adesva
      @adesva 4 ปีที่แล้ว +19

      He mentions for-range loops in the video and says it will be covered later in the series

    • @arthur1112132
      @arthur1112132 4 ปีที่แล้ว +9

      ​@@qatarking2498 & used at variable declaration is the 'reference' token in C++ In addition to the C 'get adress of' meaning everywhere else. so here, 'auto &string' means declare a variable reference of automatic type named "string" :)
      also, i think a for-range loop would have been a bad example of what he wanted to demonstrate since in that case, 'auto' refers to 'std::string' and he wanted to show how long an itterator can be

    • @shutout951
      @shutout951 3 ปีที่แล้ว +2

      Be careful that you don't write that loop when using namespace std; then you'll be overriding the name of the string variable inside the for loop.

  • @reshmamundamkotil7126
    @reshmamundamkotil7126 5 ปีที่แล้ว +49

    I feel blessed for finding this channel. Thank you man. I mean a lottttt.

    • @vivekkoul4428
      @vivekkoul4428 3 ปีที่แล้ว +1

      Hi how far have u reached with C++ now that it's already 2 years passed

  • @izukaa
    @izukaa 5 ปีที่แล้ว +50

    Hey, theCherno! Greetings from Romania, you're my first choice when comes to C++ tutorials. Nice job!

  • @AgentM124
    @AgentM124 7 ปีที่แล้ว +520

    I use auto to drive to my work

    • @will8090
      @will8090 7 ปีที่แล้ว +39

      I use my drive to auto work

    • @pixarfilmz4769
      @pixarfilmz4769 6 ปีที่แล้ว +37

      I auto drive my work to use

    • @marcdroz3369
      @marcdroz3369 6 ปีที่แล้ว +20

      auto_comment(!=creative){};

    • @bluehornet6752
      @bluehornet6752 4 ปีที่แล้ว +2

      My auto broke, so now I can't work...

    • @massiveblackwood
      @massiveblackwood 4 ปีที่แล้ว +1

      I work auto to drive home

  • @christ4791
    @christ4791 7 ปีที่แล้ว +50

    You know the day is gonna be good when cherno uploads a video

  • @dordan9987
    @dordan9987 4 ปีที่แล้ว +63

    15:00 How I feel about c++

    • @godnyx117
      @godnyx117 4 ปีที่แล้ว +3

      LMAO!!! 6 months later, how you feel now?

    • @AgentM124
      @AgentM124 3 ปีที่แล้ว +7

      @@godnyx117 You know why programmers have 2020 vision?
      It's cause they C++

    • @apotheos4783
      @apotheos4783 3 ปีที่แล้ว

      I still don't feel what you feel.

    • @adryelgainza1530
      @adryelgainza1530 3 ปีที่แล้ว +2

      Almost a year. How are you now?

    • @moonyl5341
      @moonyl5341 5 หลายเดือนก่อน +2

      4 years later, do you still agree?

  • @silurust
    @silurust 4 ปีที่แล้ว +6

    Good explanation. Good guideposts.
    I can still remember a long cursing session from an experienced C++ programmer colleague when C++11 came out. When we asked why, the short answer was: "auto". His opinion was that the possible abuse significantly outweighs the benefits. (Perhaps, by time, he stopped having allergic reactions.)

  • @robertmoats1890
    @robertmoats1890 3 ปีที่แล้ว +12

    I'm a huge typedef fan when templated code results in messy or confusing typenames. I don't use auto very often, but I do like your usage for iterator typenames. In those cases, the auto keyword is unlikely to get you into any trouble. I think in most other cases, it actually IS likely to get you into trouble. It is a useful tool to help dig your own grave.

  • @JayAnAm
    @JayAnAm 5 ปีที่แล้ว +8

    Nice explanation. One other use-case for auto is when migrating your C++ application to 64 Bit I would prefer auto over types like unsigned int that could behave in a different way for 32 Bit vs 64 Bit compilation.

    • @keris3920
      @keris3920 4 ปีที่แล้ว +4

      Use size_t for this. That is its purpose

    • @rastaarmando7058
      @rastaarmando7058 4 ปีที่แล้ว

      just use int64_t bro.

  • @syirogane
    @syirogane 2 ปีที่แล้ว +11

    I like "auto" (and its variants in other languages) for when the actual type is of little or no interest to me (though I generally avoid it for basic types), and the times the actual type is of no interest is when the algorithm itself is far more important than the actual types involved. Also, "auto" should be considered mandatory when the type is explicit elsewhere in the line (result of a cast, new, etc), but I don't consider 5.0 or 5f to be sufficiently explicit.

  • @michaelwplde
    @michaelwplde 4 ปีที่แล้ว +2

    11:00 Careful there, not sure whether constness, references i.e. & amp, are not conveyed in raw auto usage. 13:30 Exactly...

  • @VasaMusic438
    @VasaMusic438 6 ปีที่แล้ว +12

    again a great episode !! clear and full of real code experience !! Thank so much!!

  • @koungmeng
    @koungmeng 5 ปีที่แล้ว +7

    std::unordered_map is just like a dictionary in python. That means it contain key , values pair:
    eg:
    std::unordered_map dict={
    {"one",1}, {"two",2}};
    std::cout

  • @leixun
    @leixun 4 ปีที่แล้ว +10

    *My takeaways:*
    1. *auto* could automatically work out what's data type suppose to be 0:11
    2. When we might not want to use *auto* 5:04
    3. A better way to use *auto* 8:58

    • @reynep
      @reynep 10 หลายเดือนก่อน

      Should be pinned

  • @abbudeh
    @abbudeh 7 ปีที่แล้ว +15

    Thanks for your great explanations. It would be great if you talk about lambdas and assertions in C++14 :)

  • @maishamolepo2216
    @maishamolepo2216 4 ปีที่แล้ว +7

    Really good video. A suggestion on what to make next: Data structures 😀

  • @AnimeKing-m2t
    @AnimeKing-m2t 4 หลายเดือนก่อน

    How can I click "Like" on all your videos at a time? Because your way of explaining the concept is so lucid that I can easily conclude I'm gonna like all your videos..Hands down 🙌

  • @michaelwplde
    @michaelwplde 4 ปีที่แล้ว +2

    1:40 auto for lambda variables is tremendously helpful... But if you need a specific base template type, might not be a good use for auto.

  • @smileynetsmileynet7922
    @smileynetsmileynet7922 4 ปีที่แล้ว +5

    I know a lot about C++, but still some stuff like auto is new. My BIG use so far of it, is to create a language. This language will later have so much features that it needs to have multiple languages to describe it, probably.

    • @vadiks20032
      @vadiks20032 3 ปีที่แล้ว

      as far as i understand programming is a big thing and you can't just learn C++ in 2000 and never ever learn anything new, because there are gonna be updates, there are gonna be new libraries, and other stuff. so it is not weird its new for you even though you know lots about C++

  • @miteshsharma3106
    @miteshsharma3106 7 ปีที่แล้ว +112

    Talking about templates .....
    You said there will be many more videos on templates ... you could make that next !!

    • @tahamagdy4932
      @tahamagdy4932 5 ปีที่แล้ว

      SimGunther Hello Haskeller :D

    • @jerfersonmatos28
      @jerfersonmatos28 4 ปีที่แล้ว

      Thay are in the game engine series

  • @arthur1112132
    @arthur1112132 4 ปีที่แล้ว +3

    I personally prefer to use 'auto' only in prototyping and research purpose. When I tests some stuff, 'auto' is kind of a quick way to do and try stuff. But once i finished to test and i'm actually working on a real project, i do preffer to use real types (or typedef/using for types that are really long or that mignt change in a future version). Also, typedef helps to change a whole ABI as well, but still restraining varibles to a single type. So changing types remains really easy that way :)

  • @DanielLiljeberg
    @DanielLiljeberg 6 ปีที่แล้ว +11

    I was just about to write that auto is so nice when working with itterators for crazy collections :)

  • @OmarAbdelaziz__47
    @OmarAbdelaziz__47 5 ปีที่แล้ว +5

    two years ago of creating this video.
    Happy new year cherno!

  • @Adam_Lyskawa
    @Adam_Lyskawa 2 ปีที่แล้ว

    That seems quite useful for prototyping. You know, a quick and dirty, short piece of code as POC, test if an idea works, then replace "auto" with proper types.

  • @MsJavaWolf
    @MsJavaWolf 6 ปีที่แล้ว +5

    I also really like knowing my types and being explicit. Many people think C++ is too verbose, but I think it helps in bigger projects. In languages like Python you will often see a ton of comments instead, telling you what types a function is expecting etc. I quickly becomes as long or longer than C++ code, which is self documenting to a certain degree.

    • @simonmaracine4721
      @simonmaracine4721 5 ปีที่แล้ว

      Or just use type hints instead of comments.

  • @PerchEagle
    @PerchEagle 5 ปีที่แล้ว +2

    I like the different possible options to do something ! so I can use auto, typedef or even define !
    but auto is a nice feature and it absolutely simplify things. Like small embedded projects that are easier to debug and also with using it, the code would be less prone to have errors or warnings.

  • @ChopsTwo
    @ChopsTwo 7 ปีที่แล้ว +6

    I think a better rule of thumb would be that you should specify the type explicitly when you need to know the type explicitly, and use auto when you don't, which is almost all the time really. It's still a strongly typed language, so the compiler will still make sure everything is correct.
    The idiom of using auto is common enough in the C++ community that it has a name, AAA, or Almost Always Auto.
    A real benefit to using auto even when the type is short is that implicit conversions are not allowed - so if the API changes and you have auto, there won't be unnecessary conversions all of a sudden, where there might be if you specified the type manually.
    Not a whole lot can be done to address the problem of needing to manually look up the type when you use auto, except that in my experience, it's much rarer to need to do that than it would seem at first glance.
    My recommendation would be to give both my and Cherno's strategies a go and see which you like - it really isn't *that* important which you choose. It will probably come down to what kind of work you do. I've done a lot of refactoring, and when a code base doesn't use auto, it tends to become a mindless task of changing the type to match the new type when auto would have just worked correctly, as well as unintended performance and correctness bugs from surprising type conversions that auto would have avoided.

  • @Daniel-q6x2s
    @Daniel-q6x2s หลายเดือนก่อน

    I aspire to make a list of all Charno's 'don't-use' coding styles and request a code review from him.

  • @Brahvim
    @Brahvim 2 ปีที่แล้ว +3

    Smart pointers, and here we have these.
    _They're slowly making it JavaScript 🤣_

  • @enjoylife6543
    @enjoylife6543 4 ปีที่แล้ว

    Great tut!
    8:06

  • @clemenswolfbartl5138
    @clemenswolfbartl5138 4 ปีที่แล้ว

    As a Kotlin developer, I have to say this is not an issue to not specify the type and just infer it, from the perspective that you can't read the type when you take a look at the declaration. The IntelliJ Idea has a feature that lets display the inferred type (in Kotlin). There is maybe a plugin to let display the inferred type in visual studio. This is more an tool problem than a language feature problem.

    • @andrefaustino5514
      @andrefaustino5514 2 ปีที่แล้ว

      I don't know before but, in MVS2022, if you double click ctrl it shows you the infer type before the var name, just like IntelliJ. I think C++ devs have a tendency of been extra careful with types, for understandable reasons, but auto can be helpful for a cleaner code.

  • @anthonyduran2627
    @anthonyduran2627 3 ปีที่แล้ว

    bless yo intelligent, puzzle solving soul

  • @GenjaOrigins
    @GenjaOrigins 3 ปีที่แล้ว +1

    I wish you teach hashMap HashSet etc i see some so difficult examples and some simple ones

  • @billybollockhead5628
    @billybollockhead5628 2 ปีที่แล้ว

    On my team, we have a rule. If you use Auto, you need to have a VERY VERY VERY good reason to do so. As, personally, I like "self documenting" code, where I can debug something sometimes just by following it through. Usually, I can spot a bug just because auto has been used (coder thinks its a float, but it's an int, or something)

  • @hvvijuka
    @hvvijuka 2 ปีที่แล้ว

    you are really good in C++
    thanks

  • @aritzh
    @aritzh 7 ปีที่แล้ว +2

    I know you would probably not use smart pointers, but what would you write:
    std::unique_ptr obj_ptr = std::make_unique(whatever);
    auto obj_ptr = std::make_unique(whatever);
    I am asking because std::unique_ptr is not that long, but for me it seems quite redundant, since the std::make_unique already tells the exact type

    • @rj00a
      @rj00a 7 ปีที่แล้ว +1

      I think most programmers would use auto there.

  • @annsgal2025
    @annsgal2025 2 ปีที่แล้ว +1

    The main reason I don't use auto is because it makes it impossible to detect integer overflows. I only use it for iterators.

  • @grzegorzdomagala9929
    @grzegorzdomagala9929 3 ปีที่แล้ว

    auto is a blessing - espacially when you need to declare iterator for std::list of std::map - and thank the holly c++ standard committee for "for(auto a : list) :)

  • @Favo52
    @Favo52 4 ปีที่แล้ว +2

    So when looking in a map this would be a good use too?
    auto it = map.find(x);
    if (it != map.end())
    // do something

  • @vhxhao
    @vhxhao 4 ปีที่แล้ว +4

    Will there be a performance difference between actual type and auto keyword?

    • @nonnullptrhuman504
      @nonnullptrhuman504 2 ปีที่แล้ว +2

      I don't think so.. Because the type is always known at compile time.

  • @Maikie-s8o
    @Maikie-s8o 5 หลายเดือนก่อน

    i love chernos video, love from China

  • @spwim
    @spwim 4 ปีที่แล้ว

    could auto be interesting when doing math-functions on mathematical operations?
    Like you could pass either doubles, floats, or ints to them?
    auto SomeFunction ( auto aNumber, auto anotherNumber){
    auto result = do some fance math;
    return result;
    }

    • @gtrsteve
      @gtrsteve 8 หลายเดือนก่อน

      That is a sutuation for templates... :)

  • @StevenMartinGuitar
    @StevenMartinGuitar 2 ปีที่แล้ว

    You have to decide whats the biggest time saver....not typing the huge data type three times in your code.... or not having to play Sherlock whenever you maintain the code or explain it to others

  • @urduislamicstatus2107
    @urduislamicstatus2107 4 ปีที่แล้ว

    your english is amazing

    • @xzy7196
      @xzy7196 4 ปีที่แล้ว

      Why wouldn't it be? Like he is English.

  • @spwim
    @spwim 4 ปีที่แล้ว +1

    could auto be interesting when doing math-functions on mathematical operations?
    auto SomeFunction ( auto aNumber, auto anotherNumber){
    auto result = do some fance math;
    return result;
    }

    • @Keregosh
      @Keregosh 4 ปีที่แล้ว

      Pretty sure you would use templates for that instead

    • @AyushSingh-lo4qo
      @AyushSingh-lo4qo 4 ปีที่แล้ว

      I think there would be a problem with this even if it does work in precision or simply deducing the type. Because of the different number of trailing points, Or even in big numbers where if a double and a double are multiplied and return type is an int we lose precision.

  • @Vermilicious
    @Vermilicious 4 ปีที่แล้ว +1

    Anything that is implicit is sort of bad, because it assumes some additional knowledge, and you have to think about multiple things at the same time when looking at it. Auto is such a thing, and the pointer-to-char constructor of the string class is another, which is mentioned in this video. I would just avoid these things if possible. I think perhaps they introduced auto to make the language seem more appealing compared to loosely typed languages, but if they really wanted to allow loose typing in C++, they should've tried to get rid of the auto keyword entirely (which would break a lot of things). I suspect auto will end up on lists of regret eventually.

  • @GuruPrasanna
    @GuruPrasanna 2 ปีที่แล้ว

    'auto' isn't "type erasure" but "type INFERENCE". I see it as a convenience feature. C++ is still very strongly typed. It is just that you don't need to specify the type in places where the compiler can infer it.
    For C++ to lose its strong typing, you should be able to use "auto" for function params in its signature, or member variables. You can't.

    • @EvilSapphireR
      @EvilSapphireR 2 ปีที่แล้ว

      I don't see any way a compiled language can ever be weakly typed.

  • @544mamama
    @544mamama 4 ปีที่แล้ว +3

    1:24 am not gonna take 10 mins
    *takes 17 mins

  • @erwinschrodinger2320
    @erwinschrodinger2320 3 ปีที่แล้ว +2

    Great!

  • @alexissuarezalvarez5622
    @alexissuarezalvarez5622 4 ปีที่แล้ว +1

    can auto replace template?
    hi, can auto replace template? i am new to c ++ :(

  • @berktopbas1496
    @berktopbas1496 3 ปีที่แล้ว

    I cannot get the deduced "auto" type(int,char etc.) by compiler with mouseover in VS code(3:00) Is it an extension feature?

  • @Mental-Walk
    @Mental-Walk 3 ปีที่แล้ว

    Another great video brother. But you missed the fact that we can't use auto without initializing it(I think).
    Thanks for the great series.

    • @Mental-Walk
      @Mental-Walk 3 ปีที่แล้ว

      @Borislav Kamenov it's interesting. But how?

    • @Mental-Walk
      @Mental-Walk 3 ปีที่แล้ว

      @Borislav Kamenov Yeah brother, C++ does not allows to use it without initialisation.

  • @Kapil_Thakar
    @Kapil_Thakar 2 ปีที่แล้ว

    I am gonna watch all videos!!!!

  • @mrboyban
    @mrboyban 3 ปีที่แล้ว

    Great video, it is basically like an automagic.

  • @codysing8291
    @codysing8291 6 ปีที่แล้ว

    never seen a for loop like the one you did
    i normally use
    for(int i = 0; i < strings.size(); i++)
    {
    // do things
    }

    • @kocho4242
      @kocho4242 6 ปีที่แล้ว +2

      I normally use something shorter. Since C++11, it is recommended way to iterate through the container.
      for (auto& s : strings)
      {
      // do things
      }

  • @zyghom
    @zyghom 2 ปีที่แล้ว +2

    all was ok until probably episode 40-50, now it is becoming ... too fast and too difficult ;) still 50 to go

  • @casperes0912
    @casperes0912 4 ปีที่แล้ว

    Instead of having to write string you can write auto... Fantastic... You save 2 chars. With int you even use extra chars. A keyword like this has its uses but if you're declaring an int... Just declare the int. If it is absolutely assured to stay an int at least

    • @lotrbuilders5041
      @lotrbuilders5041 3 ปีที่แล้ว

      That works great, if you’re only using strings and ints. And you’re sure your interface will never change type and your not using lambdas

  • @Gojam12
    @Gojam12 2 ปีที่แล้ว

    My compiler disagree's with the char* returning a "Cherno". Any ideas why. I assume its because I am on a different C++. I believe I am on C++13 but not sure. In fact it causes two errors one on name.size() and the other on the char*.

  • @ShNeoteric
    @ShNeoteric 4 ปีที่แล้ว +1

    So auto is like the var variable in c#?

  • @zantazanta2906
    @zantazanta2906 3 ปีที่แล้ว

    Thanks for your good job

  • @KillzoneKid
    @KillzoneKid 7 ปีที่แล้ว +30

    Making vid about auto and not mentioning lambdas is a crime! ;)

    • @alexjustmd
      @alexjustmd 7 ปีที่แล้ว +2

      Killzone Kid because templates ftw;)

    • @AmeshaSpentaArmaiti
      @AmeshaSpentaArmaiti 7 ปีที่แล้ว +1

      he's probably building up to it. he only introduces one concept per video. which is fine, since people wanting to learn about auto don't automatically want to learn about lambdas.
      i, for instance, use auto to skirt around the stl's seeming hatred for memorable names.

    • @TheCherno
      @TheCherno  7 ปีที่แล้ว +12

      Yes, good point! I'll definitely mention that in the lambda video. :)

  • @fipabrate
    @fipabrate 7 ปีที่แล้ว +24

    i use auto to declare a lambda functions

  • @erickruhcardozo
    @erickruhcardozo 10 หลายเดือนก่อน

    In a language that's overwhelmingly verbose by default, they add a feature that enables you to type less and program faster, then all of the sudden there's a bunch of pseudo programmers mad at you because, according to them, with today's IDEs, they "can't figure out the type of the variable".
    OH COMMON!

  • @CoolModderJaydonX
    @CoolModderJaydonX ปีที่แล้ว

    I usually just use auto for function pointers or something where I don't know what the type is.

  • @lavi1172
    @lavi1172 3 ปีที่แล้ว

    very good video. thank you!

  • @amarbs3287
    @amarbs3287 4 ปีที่แล้ว

    Is this done during preprocessing stage or compilation stage

  • @Hazit90
    @Hazit90 6 ปีที่แล้ว

    thanks for the video. You answered a few questions :)

  • @anonymous-vj7jk
    @anonymous-vj7jk 3 ปีที่แล้ว

    thank you very much

  • @matt-g-recovers
    @matt-g-recovers 3 ปีที่แล้ว

    Result!

  • @Theawesomeking4444
    @Theawesomeking4444 3 ปีที่แล้ว +2

    so its basically How to turn C++ into Python

  • @ankitjayswal5183
    @ankitjayswal5183 3 ปีที่แล้ว

    So when do we use & with auto?

  • @YourMaster000
    @YourMaster000 3 ปีที่แล้ว +1

    What is ur laptop specs

  • @eddyecko94
    @eddyecko94 5 ปีที่แล้ว

    Normally use it with templates if the there's a possibility of different return types.

  • @fishyperil2153
    @fishyperil2153 7 ปีที่แล้ว

    I was hoping you'd talk more about the "dark side" of auto ^^ you know, the stuff you mentioned in the end , how it can work with templates etc.
    But the video was still pretty useful . Up to now whenever I came across code that used auto I was never really sure what the reason for using it was. This helped clarify that a lot of it is just for convenience purposes.

  • @andregoulbourne839
    @andregoulbourne839 3 ปีที่แล้ว

    Very helpful, coding in java and needed a little translation.

  • @yunhuaji3038
    @yunhuaji3038 3 ปีที่แล้ว

    What's the plug-in/extension that you use to show the actual type of auto when hovering the cursor on the variable? Is it available for VScode on macOS? Thanks!

    • @Xiefux
      @Xiefux 3 ปีที่แล้ว

      it works for on vscode on linux

  • @fahimkamalahmed3544
    @fahimkamalahmed3544 5 ปีที่แล้ว

    The video was helpful. Thanks.

  • @Krokoklemmee
    @Krokoklemmee 7 ปีที่แล้ว +1

    will you also cover decltype(auto) at some point in the future?

    • @platin2148
      @platin2148 7 ปีที่แล้ว

      OtakuNewb As it is part of the language surely.

  • @meer_kat5158
    @meer_kat5158 3 ปีที่แล้ว

    Hi
    char *GetName()
    {
    return "Hello";
    }
    this is a bot confusing. Won't this be destroyed when the scope ends? Can you return a pointer to an array on stack? Can you please explain how can a function return reference? It is very confusing.

  • @edwinmartens7459
    @edwinmartens7459 2 ปีที่แล้ว

    I NEVER use things like auto (or var in C#)
    Why ?
    Auto location = GetLocation();
    So tell me, what is the type of location in this statement? That is why !

  • @mmaranta785
    @mmaranta785 3 ปีที่แล้ว

    You’re the best

  • @nathandecena7694
    @nathandecena7694 6 ปีที่แล้ว +1

    So, i can determinate that keyword in C++ is like keyword in C#, JS, and now JAVA10?
    Am i rigth?

  • @ImNotGam
    @ImNotGam ปีที่แล้ว

    I think the only time I've ever used auto is when I used auto specifically just so that I could use auto because I never had before. I very quickly changed it away from auto because it didn't help anything at all.

  • @hawks3109
    @hawks3109 2 ปีที่แล้ว

    You should avoid auto unless it's very obvious what the type is. Auto can make mistakes and it's not obvious to the next programmer what the type is supposed to be. It goes against strongly typed language ideology. This is kind of like a dynamic type during compile time.

  • @marcinlesniewski4571
    @marcinlesniewski4571 4 ปีที่แล้ว

    Elegancko

  • @laike9m
    @laike9m 7 ปีที่แล้ว +1

    Can you make a video about move semantics?

  • @blackwizards1692
    @blackwizards1692 5 ปีที่แล้ว

    Thanks for this! Couldn't understand the concept no matter how much I tried, now I did! Cheers

  • @katewolf00
    @katewolf00 3 ปีที่แล้ว

    so basically, auto in C++ is like var in javascript where it chooses the type for you? neat

  • @beaverundercover3479
    @beaverundercover3479 2 ปีที่แล้ว

    Thanks. For the time being as a beginner auto adds a layer of opacity and is therefore best avoided.

  • @BobChess
    @BobChess 10 หลายเดือนก่อน

    Auto in C: 😭
    Auto in C++: 🗿

  • @GenjaOrigins
    @GenjaOrigins 3 ปีที่แล้ว

    ordered unordered map videos please sir Di Cherno!!!

  • @violinsheetmusicblog
    @violinsheetmusicblog 5 ปีที่แล้ว

    Can you make a video on iterators?

  • @alltheway99
    @alltheway99 4 ปีที่แล้ว

    Is that a Pixel 2 XL next to you on the couch ?
    🙂

  • @MicheleGobbato71
    @MicheleGobbato71 4 ปีที่แล้ว

    The Playlist for the C++ series is disappeard :-(

  • @Chiramisudo
    @Chiramisudo 5 ปีที่แล้ว +4

    Did you say Welcome to 2020? 😋

  • @prashantdhonde7891
    @prashantdhonde7891 4 ปีที่แล้ว

    Does auto helps in better memory management?

  • @chainonsmanquants1630
    @chainonsmanquants1630 4 ปีที่แล้ว

    Thanks