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

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

КОМЕНТАРІ • 30

  • @yrspookydad644
    @yrspookydad644 9 місяців тому +5

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

    • @geekingjadi
      @geekingjadi  9 місяців тому +1

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

  • @emyrulz
    @emyrulz 9 місяців тому +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  9 місяців тому

      thanks for the explanation. Learned from it

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

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

  • @jaxfrank
    @jaxfrank 9 місяців тому +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  9 місяців тому +1

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

  • @aurelienfocant659
    @aurelienfocant659 8 місяців тому

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

  • @aboozarsobboohi827
    @aboozarsobboohi827 9 місяців тому +1

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

  • @dawngunz
    @dawngunz 9 місяців тому +3

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

    • @geekingjadi
      @geekingjadi  9 місяців тому

      sorry for that. was a technical mistake during the recording

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

    Thank you dear Jadi❤

  • @Tech-ub8dd
    @Tech-ub8dd 9 місяців тому

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

    • @geekingjadi
      @geekingjadi  9 місяців тому +1

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

  • @colemichae
    @colemichae 9 місяців тому

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

  • @smartnima
    @smartnima 9 місяців тому

    Hey jadi! nice video :)

  • @oundhakar
    @oundhakar 9 місяців тому

    This was awesome!

  • @mmt0000
    @mmt0000 9 місяців тому

    Ostad Qorbone Lahjat Beram ❤🇮🇷

  • @atajahangiri5861
    @atajahangiri5861 9 місяців тому

    VERY very GOOD video

  • @ates641
    @ates641 9 місяців тому

    Awesome content subbed

  • @anonymousghost5384
    @anonymousghost5384 9 місяців тому

    🙏🙏🙏🌺🌺 Thanks an ocean

  • @justice83
    @justice83 9 місяців тому +2

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

  • @Kyoz
    @Kyoz 9 місяців тому

    🤍