#1211 C++ Comments and continuation characters..

Scintilla (793)

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 - 2011-08-17
    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 3
    • status: open --> open-invalid
  • Neil Hodgson

    Neil Hodgson - 2011-08-17

    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.

  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2011-08-18

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

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

    Neil Hodgson - 2011-11-01
    • status: open-invalid --> closed-invalid

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks