Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#1211 C++ Comments and continuation characters..

Neil Hodgson
Scintilla (790)

I originally reported this on Notepad++ but was told that it needed to be reported on Scintilla. The problem is related to the handling of the continuation character when it is the last item of a C++ style comment line.

For example:
// This is a comment that happens to have a continuation character at the end \

The C/C++ compiler will treat the "a=1;" line as a continuation of the comment line. You will get a warning (thankfully) but Notepad++ doesn't recognize the continuation character as a continuation of the comment. With MS VS it will color code both the comment line and the "a=1;" line to give the programmer a visual of what is going on.

I ran into this because I had the following in my comment line:
// this is my comment from the directory /a/b/c/
if (a==1)
{ }

The compiler gave me a warning of a multiline comment but I didn't pay attention to it... it then commented out the if statement and allowed the code to fall into the block set off by the if.

It would be useful to have the parser recognize the continuation character at the end of the single line comment and have the next line color coded appropriately to give a visual to the developer that the next line is also considered a comment line.


  • Neil Hodgson
    Neil Hodgson

    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 3
    • status: open --> open-invalid
  • Neil Hodgson
    Neil Hodgson

    The C++ lexer recognises a final '\' as a continuation. see this screenshot:

    In the problematic sample, the comment line finishes with a '/' not a '\' and '/' is not a continuation character.


  • Anonymous

    Sorry, you are correct. The comment line has to end with '\'.

    Last edit: Anonymous 2013-10-20
  • Neil Hodgson
    Neil Hodgson

    • status: open-invalid --> closed-invalid