| ▲ | antirez 4 days ago | ||||||||||||||||
I made a point here https://antirez.com/news/124 that comments are needed at the same time for different reasons, and different comments have differente semantical properties that can be classified in classes you very easily find again and again, even in very different code bases. | |||||||||||||||||
| ▲ | commandersaki 4 days ago | parent [-] | ||||||||||||||||
This is a great post and meshes with how I like to comment as well. I like to break the so called rules and get a bit dirty when it comes to writing code and comments. My opinion which you state, is to remove the effort from the reader in needing to figure things out a second, third, or n-th time. Here is one I wrote just to talk about iterating a loop in reverse:
Or here is another for masking a v4 address, but also explaining why a uint64 is used (this is calculated in a hot loop [same as the previous comment example], so I felt it was imperative to explain what is going on as there is very little room otherwise to optimise): | |||||||||||||||||
| |||||||||||||||||