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.
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.
We need more of these! This is so cool, I added my own command to the best editor
glad that you liked it. will try to record more :)
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.
thanks for the addition to the video. learned from it :)
This is amazing. I will always cherish your videos. Your spirit of exploration is something I hope to match someday. 😎
You can do it!
Heyo! I would highly recommend turning down the gain on your mic input. Otherwise, great video!
sorry for that. was a technical mistake during the recording
Jadi, thanks so much, I love your videos, learning so much !
You are so welcome!
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.
thanks for the explanation. Learned from it
I love these type of videos. Albeit, whatever you post I like.
Glad you like them!
Thank you dear Jadi❤
You're welcome 😊
What.. you didnt use vim to inspect its source code. Vim is sad 😢
:D funny
Hey Jadi, what keyboard do you use? Looks very slick!
keycron k3 it is. but not that important. any keyboard will work :D
Ostad Qorbone Lahjat Beram ❤🇮🇷
This was awesome!
Cool i tried it in neovim my sctaan is too small to see what it is but yes something appeared
Hey jadi! nice video :)
VERY very GOOD video
🙏🙏🙏🌺🌺 Thanks an ocean
You're welcome 😊
Awesome content subbed
Appreciate it!
🤍