C++ From Scratch: Constexpr

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 32

  • @a-r-r-o-w
    @a-r-r-o-w 2 роки тому +8

    Great work man. I've been following the daily series for a week now and I really like the explanations with examples, and it's been nice revising concepts!

    • @NotesByNick
      @NotesByNick  2 роки тому

      Thank you! Glad you have enjoyed them! :^)

  • @Martial_Monkey
    @Martial_Monkey Рік тому +3

    Awesome explanation. Especially with showing the assembly. constexpr finally makes sense for me.

  • @deoabhijit5935
    @deoabhijit5935 2 роки тому +4

    Hey nick! I have been following this series and learned so many things. Your ability to explain the concepts is amazing.
    Thank you very much!

    • @NotesByNick
      @NotesByNick  2 роки тому

      Glad you’re enjoying the videos! :^)

  • @sameda9698
    @sameda9698 Рік тому +1

    Best explanation with nice examples. Getting back to C++ after a while and like your video a lot. The depth, examples and the way you present it are all nice. Thanks!

    • @marcjukil300
      @marcjukil300 10 місяців тому

      In the video, the program is build in debug mode. Which disable optimisations.
      If the non constexpr code is built in release mode, there is a high chance that the result is calculated at compile time.
      I think

  • @vintagewander
    @vintagewander 2 роки тому +1

    Hey I've been watching you for a while and I just noticed that you're now making C++ videos daily!
    I'm really glad that you're teaching C++ the modern way instead of starting from raw pointers in C like most people do, this is really helpful for people that are starting with C++ in the modern world using modern syntax
    I'm really looking forward to more advanced modern features in C++20 in the future if you plan to do them, like ranges and template parameter pack because I've been out of the C++ loop for a while now 😂

    • @NotesByNick
      @NotesByNick  2 роки тому +2

      Thanks! Glad you are liking the videos. This series is nearing its end (I think I want to checkpoint this as an intro course to C++, rather than keep it going indefinitely), but I will be starting a couple more series. One catering more toward software development with C++ (where more of the niche C++ features will go, along with topics like debuggers and build systems), and another more heavily focused on parallel programming with C++.
      Cheers,
      --Nick

  • @gavwolf123
    @gavwolf123 2 роки тому +3

    Great video! Was really helpful in answering some of my doubts regarding compile time and runtime. I was wondering whether you could make a video about iterators?

    • @NotesByNick
      @NotesByNick  2 роки тому +2

      I have a basic video on iterators that was earlier in the series - ua-cam.com/video/-gW8amxCnrM/v-deo.html
      Was there something else that you wanted covered?

  • @protheu5
    @protheu5 Рік тому +2

    Very nice explanation, thanks

  • @daveamiana3957
    @daveamiana3957 7 місяців тому +1

    Very clear explanation. Appreciate it!

  • @nikcname
    @nikcname Рік тому +1

    Hi Nick, your terminal looks very nice, which one you are using? Thx!

  • @albertosantana1174
    @albertosantana1174 3 місяці тому

    Very clear explanation, thanks!.

  • @fw3mbedded598
    @fw3mbedded598 10 місяців тому

    your way of explanation is great , thanks a lot . would you kindly explain how would the assembly look like at the last stage / what is the performance effects ?

  • @hilium3000
    @hilium3000 Рік тому +1

    Thanks. It was a useful example.

  • @VoidloniXaarii
    @VoidloniXaarii Рік тому

    Very interesting asm extractions, thank you very much

  • @joshbolton2782
    @joshbolton2782 Рік тому +1

    Amazing video. Thank you so much!!!

  • @christianmirandahehim8144
    @christianmirandahehim8144 4 місяці тому +1

    thanks for the video!

  • @TKcKoucher
    @TKcKoucher 11 місяців тому

    Great work! Very good explanation!

  • @gaborharangozo1587
    @gaborharangozo1587 Рік тому +1

    damn well explained, thanks man!

  • @proudsnail1417
    @proudsnail1417 Місяць тому

    great explanation :) thanks

  • @mikemota
    @mikemota 10 місяців тому

    Thanks!

  • @abhi-s6f7m
    @abhi-s6f7m 6 місяців тому

    Thanks

  • @SnakeEngine
    @SnakeEngine Рік тому

    Why can't the compiler just do the right thing without this feature? It has the same information about the code as you do to accomplish this goal.

  • @anon_y_mousse
    @anon_y_mousse Рік тому +1

    This is another point where C++ annoys me. I get that they didn't want to reuse an old keyword and change its behavior, but they should have anyway. I don't know if it would have broken any older C++ programs that used inline lazily, but since I use g++ I don't care. I take the approach here that if it would have broken any old code then that code was likely wrong anyhow. In fact, I'd dare say that const and inline should have both been changed and constexpr is just a dumb keyword. Anyone else agree?

    • @sledgex9
      @sledgex9 10 місяців тому +1

      One of C++'s strongest points is its strong backwards compatibility. The python2 -> python3 fiasco would be huge in the C++ world due to the sheer size of code out there.

    • @anon_y_mousse
      @anon_y_mousse 10 місяців тому

      @@sledgex9 And I maintain that breaking such code would be fine because they're likely using the preexisting keyword wrong anyhow. If something is labelled const, it should be const, not some quasi-const nonsense.

    • @lemonk1230
      @lemonk1230 6 місяців тому

      ​@@anon_y_mousse I don't think "possibly breaking production code is fine" is a reasonable attitude to take when setting the standard for a massively popular language.

    • @anon_y_mousse
      @anon_y_mousse 6 місяців тому

      @@lemonk1230 It's not as though they haven't made production code breaking decisions before and multiple times. This would've been a positive change had they done it.