Make the code compile in ansi, c99 and c++ modes

The bulk of it were the comments. AFAIK, most of the compilers won't give a shit, but if you want to leverage gcc/clang's -pedantic, you have to play by the rules. The comments commit contains only comment diffs.

I also tried mingw and vc6 but with no good results, but I've added the build rules.