(Non) Nesting block comments

Bill Baxter wbaxter at gmail.com
Mon Jul 20 15:12:55 PDT 2009


On Mon, Jul 20, 2009 at 2:46 PM, Michiel
Helvensteijn<m.helvensteijn.remove at gmail.com> wrote:
> Bill Baxter wrote:
>
>> I tend to use /* */ for writing multi-line comments.
>
> But do you not still start every line of comment with * or such? I know this
> is a matter of personal style, but I figured: might as well use // for
> multi-line comments.

For short doc comments, yes, I usually prefix each line with *.
Ddoc and other systems don't handle multi-line /// doc comments as you
might expect, so it's better to use /** for doc comments that are
multiline.  For non-doc comments explaining code internally I'll use
// for short ones, but if it's over 4 or 5 lines I'll use /* */
without a * prefixing each line because it gets to be too annoying
keeping all those ducks lined up, and it doesn't really help
readability any.

With /+ +/  and /*  */ I think emacs-mode uses different colors.  I
can't recall though.  If it doesn't it should. :-)  So that makes (or
would make) the difference between dead code and comments that I want
to keep stand out more with the way I do things.

>> I like having that distinction,
>> but I wouldn't fight very hard to preserve it if there was some good
>> reason to kill /**/.  But so far I don't think there is such a reason.
>
> No. There is no reason, other than simplification of the language.

--bb



More information about the Digitalmars-d mailing list