I was reading the source code of vim and decided to share it with you guys too; to improve our C

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024

Комментарии • 30

  • @yrspookydad644
    @yrspookydad644 7 месяцев назад +5

    We need more of these! This is so cool, I added my own command to the best editor

    • @geekingjadi
      @geekingjadi  7 месяцев назад +1

      glad that you liked it. will try to record more :)

  • @jaxfrank
    @jaxfrank 7 месяцев назад +3

    I don't think the reverse iteration is being done for the stated reason. I think it is being done to eliminate an extra variable and guarantee that p is only incremented once. You obviously can't do n < *p++ because p would be incremented too many times. You would need another variable int count = *p++; then do n < count. Or you would need to do n < *p and print *(p+1) then increment p after the for loop. Neither of these solutions are as "clever" as what is written in the code so they weren't done. Even though it would probably make the code easier to understand.
    I think the run length encoding scheme here is pretty clever. I like it. I don't understand why they created a special case for 'x' being newline though. They could have encoded newlines as "\1
    " like they are doing with everything else. This would add maybe 30 bytes and remove an extra case. It would also allow them to consistently grab 2 characters every iteration which could make the code simpler and cleaner. It also wouldn't have the weird case where "\120a" wouldn't work as expected(not that it matters here).
    Whoever wrote this code was trying to be too clever imo.

    • @geekingjadi
      @geekingjadi  7 месяцев назад +1

      thanks for the addition to the video. learned from it :)

  • @chukwunta
    @chukwunta 4 месяца назад

    This is amazing. I will always cherish your videos. Your spirit of exploration is something I hope to match someday. 😎

  • @dawngunz
    @dawngunz 7 месяцев назад +3

    Heyo! I would highly recommend turning down the gain on your mic input. Otherwise, great video!

    • @geekingjadi
      @geekingjadi  7 месяцев назад

      sorry for that. was a technical mistake during the recording

  • @aurelienfocant659
    @aurelienfocant659 5 месяцев назад

    Jadi, thanks so much, I love your videos, learning so much !

  • @emyrulz
    @emyrulz 7 месяцев назад +2

    I don't think performance was the reason for the decrementing loop, it was because n = *p++ construct inside the for wouldn't work otherwise. Code terseness seems to be important to them by the lack of braces and empty lines.

    • @geekingjadi
      @geekingjadi  7 месяцев назад

      thanks for the explanation. Learned from it

  • @aboozarsobboohi827
    @aboozarsobboohi827 7 месяцев назад +1

    I love these type of videos. Albeit, whatever you post I like.

  • @user-st6ki2nf4c
    @user-st6ki2nf4c 4 месяца назад

    Thank you dear Jadi❤

  • @justice83
    @justice83 7 месяцев назад +2

    What.. you didnt use vim to inspect its source code. Vim is sad 😢

  • @Tech-ub8dd
    @Tech-ub8dd 7 месяцев назад

    Hey Jadi, what keyboard do you use? Looks very slick!

    • @geekingjadi
      @geekingjadi  7 месяцев назад +1

      keycron k3 it is. but not that important. any keyboard will work :D

  • @mmt0000
    @mmt0000 7 месяцев назад

    Ostad Qorbone Lahjat Beram ❤🇮🇷

  • @oundhakar
    @oundhakar 7 месяцев назад

    This was awesome!

  • @colemichae
    @colemichae 7 месяцев назад

    Cool i tried it in neovim my sctaan is too small to see what it is but yes something appeared

  • @smartnima
    @smartnima 7 месяцев назад

    Hey jadi! nice video :)

  • @atajahangiri5861
    @atajahangiri5861 7 месяцев назад

    VERY very GOOD video

  • @anonymousghost5384
    @anonymousghost5384 7 месяцев назад

    🙏🙏🙏🌺🌺 Thanks an ocean

  • @ates641
    @ates641 7 месяцев назад

    Awesome content subbed

  • @Kyoz
    @Kyoz 7 месяцев назад

    🤍