3 ms·
One of the things we train any newcomer to our company is to never do what this man does:a complex single line with expected behavior based on your (arbitrary)
by forgottenpaswrd 13y ago
One of the things we train any newcomer to our company is to never do what this man does:a complex single line with expected behavior based on your (arbitrary) conventions.
Yo always do multiple lines, with comments on each one.
It sounds ridiculous, but this simple thing made some kind of bugs impossible: those that you have in front of you but you can't see in a million years. The atomic operation in code is the line, you can't debug a complex line(1).
It is painful forcing people to do that, people use to hate being told what to do, but at the same time they love the outcome so much. In the end everybody loves it.
1.With assembly you are debugging an instance of your code. You are not debugging what will be created with any compiler, any os or architecture.
- stinos 13y agoWhile I agree the code presented is just, plain and simple, bad, and the first way to the solution is splitting it up, I really don't get why you want comments for every line? Or don't you mean literally every line maybe? I mean suppose I split the first part of the statement like this: int r = a[ i ]; ++i; These lines are self-explanatory. It's pretty hard to argue they need a comment? Especially when used in a function that already should have a name/comment explaining what it does?