Search code examples
commentsd

What do /+ and +/ indicate in D?


In some of the Derelict source code, I see some blocks that are surrounded by /+ and +/, like so:

/+ other
alias FTC_MruNodeRec*       FTC_MruNode;
alias FTC_MruListRec*       FTC_MruList;
alias FTC_MruListClassRec*  FTC_MruListClass;
+/

(Just an example, of course.) What are these? They look like comments, but the content looks like valid code. I'm not able to find anything on Google due to /+ not being a useful search string. Any help?


Solution

  • They are comments, just like /* and */ in C/C++. The different is that /+ and +/ nest, while the other versions do not.

    For example, this entire line is a comment.

    /+ A /+ B +/ C +/
    

    But with /* */, the C and closing */ is uncommented:

    /* A /* B */ C */
    

    /+ +/ helps a lot when you need to comment out large blocks of code.