While the code flow is simple and require few or none comment, the intention of the function is not.
what kschedule() actually do? does it pick a task, or it also perform the context switch?
do it modify anything in *cpu? can we call with null? what potential issue may arise (machine lock up if all task are blocked)?
do it require spinlock protection surrounding the call? etc.
These all may well be written as comment above the function.
Unhelpful comments in your code?
Re: Unhelpful comments in your code?
No, because this is a trivial and short function, despite taking up all the space on the screen. The only thing this code needs is a regex removing some newlines. (Well, some might argue that it could need a more sophisticated algorithm, but that's not the point here... )tiger717 wrote:Please have a look at this piece of code (originates from my multitasking scheduler) and tell me if you really need comments for understanding it.
Nick's code was already somewhat more interesting, but I've seen much more complex things. What you're doing here is almost like comparing Hello World to a real application.