What is data alignment? Optimality, efficiency and safety | Top-Up C++ [C++ #01]

Sdílet
Vložit
  • čas přidán 22. 07. 2024
  • #Cpp #alignment
    Check out the related article on TheWolfSound.com: thewolfsound.com/what-is-data...
    Sign up for WolfSound's newsletter: thewolfsound.com/newsletter/
    Please subscribe to WolfSound to let the little Wolf grow:
    / @wolfsoundaudio
    Address alignment with respect to some power of 2 relates to this address modulo 2 to that power. Datum alignment relates to whether a particular datum lies at an aligned address.
    In this video I am explaining how to take advantage of proper data alignment. To present the full picture, I am introducing the relevant C++ features.
    00:00 Introduction
    00:42 Address alignment
    01:16 Datum alignment
    02:58 Addess vs datum alignment
    03:20 Alignment requirement
    04:10 Handling alignment (with examples)
    08:32 C++ alignment features
    12:00 Is alignment necessary for software optimality?
    13:07 Summary
    Reference:
    [1] Article about alignment in Microsoft Docs: docs.microsoft.com/en-us/cpp/... Access: 09.04.2020
    [2] en.cppreference.com/w/cpp/lan... Access: 09.04.2020
    [3] Excerpt from the "Power and Performance in Enterprise Systems" 2015, Pages 263-273: www.sciencedirect.com/topics/... Access: 09.04.2020
    [4] Alignment optimality discussion: lemire.me/blog/2012/05/31/dat... Access: 09.04.2020
    [5] std::alignment_of vs. alignof: stackoverflow.com/questions/3... Access: 09.04.2020
    The video contains a short clip from "The Lord of the Rings: The Fellowship of the Ring" (2001) directed by Peter Jackson and produced by New Line Cinema.
    All the copyrights belong to their respective owners. Copyright Disclaimer under Section 107 of the Copyright Act 1976, allowance is made for "fair use" for purposes such as criticism, comment, news reporting, teaching, scholarship, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing. Non-profit, educational or personal use tips the balance in favor of fair use.
  • Věda a technologie

Komentáře • 26

  • @WolfSoundAudio
    @WolfSoundAudio  Před 2 lety

    Have I helped you with this video? If yes, please, consider buying me a ☕ coffee at www.buymeacoffee.com/janwilczek
    Thanks! 🙂

    • @testshar2117
      @testshar2117 Před 2 lety +1

      nah ... its just reading stuff video and not enough code examples. Pretty ordinary content and mostly reading from script. Avoid coffee anyway. Drink water. Its healthy

    • @WolfSoundAudio
      @WolfSoundAudio  Před 2 lety

      @@testshar2117 Thank you for the feedback, I'm sorry you didn't benefit from it ;) If you have any more suggestions to improve the content, then please share them with me!

    • @testshar2117
      @testshar2117 Před 2 lety +1

      @@WolfSoundAudio all the alignment macros/templates/functions you summarized , it will help to have code examples giving more details about use case and it's usage.

    • @WolfSoundAudio
      @WolfSoundAudio  Před 2 lety

      @@testshar2117 Ok, thanks :)

  • @hridaybajaj6568
    @hridaybajaj6568 Před 10 měsíci

    I really liked this video, please keep posting videos like these!
    I had no idea about this topic until I watched this video.

  • @elyasafaloni8925
    @elyasafaloni8925 Před 2 lety +4

    Great stuff all around!!! Studying C now, and this is a great explanation!
    Thank you!!! I really mean that.

  • @aqua3418
    @aqua3418 Před 2 lety +2

    Amazing explanation. You touched on it in a deeper way than I saw others do. It really clicked here. Please keep doing videos!

  • @mitchellgresham872
    @mitchellgresham872 Před rokem

    great video! explained a lot better than my textbook could and in less time too.

  • @screamodev
    @screamodev Před 4 lety +8

    Really good explanation for a topic that's been bugging me for a while. You got yourself a subscriber. The quality of the mic may need to be improved though :). Otherwise really good video

  • @drumangel3766
    @drumangel3766 Před 4 lety +2

    Nice explanation

  • @eis3nheim
    @eis3nheim Před 2 lety +1

    Amazing explanation, thank you.

  • @diogomatias6509
    @diogomatias6509 Před 3 lety +2

    Really good explanation, keep up!

  • @przekladanki
    @przekladanki Před 3 lety +2

    Nice ^^

  • @peterSobieraj
    @peterSobieraj Před 3 lety +3

    It will be good if you provide example for each keyword.
    I did understand concept of alignment while watching this video, so it's half of success.
    But I still don't know how to force my structs to be alignment.

    • @WolfSoundAudio
      @WolfSoundAudio  Před 3 lety +1

      Thanks for the remark! I may do a follow-up video which would include code examples to clarify these concepts.

  • @rishiniranjan1746
    @rishiniranjan1746 Před 2 lety +1

    thanks you... :)

  • @danielesquivel3155
    @danielesquivel3155 Před 2 lety +1

    nice

  • @nskeip
    @nskeip Před 2 lety +1

    Wow... It hurts 😅

    • @WolfSoundAudio
      @WolfSoundAudio  Před 2 lety

      Haha, no! :D Have you seen my most recent video on the topic? There is an even simpler explanation :)