I am a bit strange, sometimes i enjoy looking through kernel source code, not that i understand very much but anyway.. I picked some random code from each of openbsd, minix and linux, i want you to focus on the commenting in each.
Here is Open BSD
http://fxr.watson.org/fxr/source/kern/init_main.c?v=OPENBSD
Fairly ok, right?
Next up is Minix, and this is just beautiful:
http://fxr.watson.org/fxr/source/kernel/clock.c?v=minix-3-1-1
Now here is linux:
http://fxr.watson.org/fxr/source/kernel/time.c?v=linux-2.6
Some pickings:
* sys_time() can be implemented in user-level using * sys_gettimeofday(). Is this for backwards compatibility? If so, * why not move it into the appropriate arch directory (for those * architectures that need it).
* This is ugly, but preferable to the alternatives. Otherwise we * would either need to write a program to do it in /etc/rc (and risk * confusion if the program gets run more than once; it would also be * hard to make the program warp the clock precisely n hours) or * compile in the timezone information into the kernel. Bad, bad....
* WARNING: this function will overflow on 2106-02-07 06:28:16 on * machines where long is 32-bit! (However, as time_t is signed, we * will already get problems at other places on 2038-01-19 03:14:08)
* There are better ways that don't overflow early, * but even this doesn't overflow in hundreds of years * in 64 bits, so..
Not to whine on the linux guys.. heck, im bad at commenting myself, but its just amusing to look at the differences between code bases 🙂