auto in Modern C++ | Modern Cpp Series Ep. 88

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 พ.ย. 2024

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

  • @minecraftcookie2929
    @minecraftcookie2929 8 หลายเดือนก่อน +1

    Its very good info thanks

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

      Cheers!

  • @Gaspardkirira
    @Gaspardkirira หลายเดือนก่อน +1

    Professor, why are there no C++ courses for designing financial software for desktop?

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

      I think it's a matter of convincing some folks in the space to make courses. There are a few books you can search on amazon on low-latency and finance programming in C++ and Python recently however.

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

    awesome! I wish you teach DSA problem solving in modernC++, paid course is still no one do it.

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

      Something to consider in the future! 😀

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

    Interesting. I hope that in one of the next videos you will talk about auto&&

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

      I think there is indeed more to the 'auto' story :) auto itself is really useful I think for the use case where you really need to use it, meaning you want to write generic code and be able to let the compiler do the hard work of deducing the correct type what the variable would be. Of course, the situation you mention, with even 'auto&' as a reference type in a 'for-each' loop is useful for folks to understand the difference.

    • @vedantranade1815
      @vedantranade1815 7 หลายเดือนก่อน

      not the scary forwarding references !

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

    Which C++ style guide do you follow?

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

      Most of the time I peek at Google's if I'm unsure as they have the most encyclopedic guide. Companies I've worked at also usually default me into their style, so that's how my own personal style has evolved I suppose.

  • @MarkMcDaniel
    @MarkMcDaniel 16 วันที่ผ่านมา +1

    I really don't like auto. As a programmer, I want explicit control and clear code. Auto is a little too loosey goosey, and left to the compiler which changes over time.

    • @MikeShah
      @MikeShah  15 วันที่ผ่านมา +1

      I think 'almost always auto' is something I've backed off. That said, I'll provide a few use cases where I do and do not like auto off the top of my head below.
      Good:
      1.) auto iterator = vector::iterator // for use in a loop
      2.) auto collection = GetVectorCollectionFunction(); // Pretty reasonable
      3.) In template / generic programming, in my mind that is the real reason to have 'auto' for type deduction. It's not explicit as you say, but that's the point of generic programming.
      Bad:
      auto i = 10; // Just use int, long, etc.
      auto i = 10.0f; // Better, but still better to make this code greppable. 'f' suffix easy to miss.

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

    when using "auto", IDE becomes important.

  • @عليحامدعبدالزهرة
    @عليحامدعبدالزهرة 2 ปีที่แล้ว +1

    well, tNice tutorials is going to take forever...

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

      More tutorials coming!