Warning: this post is silly. Also: it mixes top- and bottom posting
/* This is a block comment in C. It has to be */
/* long enough to span several lines, in order */
/* to show the effect. */
I rather like it; ...
<snip>
Since this thread is FUBAR I have to ask this - When commenting code:
what style is "the best" one? (Also: when commenting code: what style
do you use?)
Since I actually like to understand the code by reading the comments
alone I tend to like to have neat comments that are understandable.
Also I hate ugly code that does the magic in a one-liner if a two- or
three-liner is equally good but provides more readability.
/*
* A nice comment that is really readable,
* on a few lines.
*/
The above example has a tendency of getting bad indentation - pretty
much like the next example. But still: the above example is how I
comment most C-code. I find it extremely readable.
/*
* An ugly comment that is really still readable,
* on a few lines.
* BEWARE: ugly/bad indentation
*/
I've seen people doing this, but I am not sure I like it:
/*
** More stars - better indentation.
** More stars - less neatness.
**/
Personally I am disgusted by comments like these:
/* A horrible comment that perhaps might be readable,
one a few lines - but here you have to use the
force to see where it ends. */
One-liners are invisible to me - they just disappear
/* I am invisible - weeee! */
In C++ and C# I tend to add an extra line before and after so that the
comments show (for some reason I do not use the /* ... */ style in C++
or C#):
//
// this loop does something to j
//
for (...)
--j;
/Per [

]-|--<
--
Per Erik Strandberg
..NET Architect - Optimization
Tomlab Optimization Inc.
http://tomopt.com/tomnet/