C++ Casting - Part 1 - Types, conversions, and C-style casts | Modern Cpp Series Ep. 91

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.ย. 2024
  • ►Full C++ Series Playlist: • The C++ Programming La...
    ►Find full courses on: courses.mshah.io/
    ►Join as Member to Support the channel: / @mikeshah
    ►Lesson Description: In this lesson I talk about one of the best features of C++ design -- the fact that it is a statically typed language! This itself can help build safer and more scalable software. That said, on occasion, we need to treat data as different types in order to evaluate correctly our results. One thing we have to take care of is the 'runtime cost' of the cast, as well as if we are going to lose precision as well!
    ►TH-cam Channel: / mikeshah
    ►Please like and subscribe to help the channel!

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

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

    Your tutorials are always very interesting 🙂 I would be very interested in your tutorial on the Finite State Machine implemented in C ++ using SDL2. Maybe with a very simple but effective code example.

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

      Cheers, thank you for the kind words! Will keep that in mind, at some point I want to cover State pattern

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

    7:31 That's... not what happens.
    When you assign "50000" to a data type like 'short' that can only hold -32000 to 32000 (roughly), or -32768 to 32767 to be more exact, you get what's called a _wrap around._ Meaning the number gets filled up to the max "32767" then continues from the opposite side, from the "-32768" value towards zero, until it reaches "-15536".
    *50000 - 32767 = 17233* (the leftover after "filling" that max 32767).
    *-32768 + 17233 = -15535.* But given that "0" is its own value... it's -15536.

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

      You are correct, that was indeed a wrap around!

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

    5:00 "5" is the wrong number for this and that's why you didn't see anything when you ran the program. Because 0-32 are blank spaces in most fonts, meant for some other purposes like ASCII art or special characters on some really old devices. You should have picked "65" which is the code point for the character 'A' - which you do at 10:03. Maybe I've seen this video before.

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

    Okay can see a left handed programmer here! XD

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

    Hey Mike, Can you create a video on template aliases in c++?

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

      There will be more template videos to continue, that topic is in the pipeline. Need to think some more on clear use cases

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

    im gonna watch all night, Im reading "Deciphering Object-Oriented Programming with C++" by Dorothy Kirk, and "Real Time C++" by Christopher Kormanyos, and I had been using videos made by "Cherno" the game programmer from Austrailia, however I feel like there a small things that you mention that others have not or maybe I missed. Any way , great videos.

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

      Cheers enjoy! Neat -- I'll check out those texts. Cherno has great content as well -- use as many resources as possible to keep learning :)