Is it illegal to end a // comment with the \ character? I accidentally hit \ before enter suddenly I'm getting hundreds of compile errors. I had this in my code:
for(i=0;i<MAX_MODULES;i++) // initialize all twenty (x3) possible thermocouple names\
Removing the trailing slash fixed it. If you're allowed to continue a comment with \ like you can a define, then dev-cpp just isn't coloring it right (the next line still shows up black). If \ doesn't continue a comment, then I'm thoroughly confused.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-08-21
>> it seemed inconsistent to color the text one way and interpret it another.
It is inconsistent, but that is not surprising. The IDE and the compiler are not the same thing, they are independently developed (one by Bloodshed, the other by GNU). The parser required for colour highlighting is not that used by the compiler.
In all other respects I agree. It seems likely that the developer did not have a thorough knowledge of the language semantics - at least not to the level required to write a compiler.
Bugs are submitted via the "Tracker" menu at the top of this page. There you can see all the others that may take priority over yours. Dev-C++ development is not particularly active at present, but that may change. The wxDev-C++ team (a Dev-C++ derivative work) may take up the issue, it is a more active project at present.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-08-20
\ is the escape sequence introducer, it causes the next character to be ignored or interpreted differently. In this case it causes the <newline> to be ignored, so that the following line is appended to the current one, in this case making the following line part of the comment, which may or may not cause a problem depending on what gets commented out - it may or may not render the rest of the code nonsense.
The 'line continuation' feature is typically used when defining complex macros across several lines (because pre-processor macros must be defined on one line). Such macros are usually ill-advised in any case, so you would not use it very often.
The upshot is that \ knows nothing about where it is used, it simply escapes the following character, and this is used typically for macros, but is active regardless and independent of the context in which it is used.
It is a nasty feature at best, if the \ were followed by whitespace other than <newline> for example, it would cease to escape the <newline>, but would be very hard to spot!
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In that case it seems like a bug in the IDE. I have some of those ill-advised multi-line macros :) and it colors each line green as it should. But when the escape character is used at the end of a // comment (blue in my case), the following line, which becomes part of the comment, is still black rather than blue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-08-20
I would suggest that is is an oversight rather than a bug. The syntax highlighter has obviously been developed with the 'normal' usage in mind only, and has restricted the continuation character to use in macros so far as colouring is concerned. Feel free to submit a bug report via the link above, but it seems a trivial issue, I doubt it will get high on the priority list.
The usage in you example was in fact a bug in your code, it is perhaps not the job of the highlighter to detect bugs, but I concede it should perhaps accurately reflect the syntax of your code, which might as a consequence help detect the bug. If you genuinely want multi-line comments then the /.../ delimiters should be used.
I checked and Visual Studio 2005 correctly colours the code. If this really irks you, Dev-C++ is probably not the tool for you, it has many more serious flaws; use the free VC++ 2005 Express Edition instead.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I was just pointing out that it seemed inconsistent to color the text one way and interpret it another. The main benefit of fixing the 'oversight' would just be to help people like me find their bugs faster (and isn't that really the point of coloring in the first place?). I would have noticed my error right away if the next line had been comment-color instead of black. It doesn't irk me because I didn't write Dev-C++. If it were my own effort, THEN it would irk me to leave it alone. :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it illegal to end a // comment with the \ character? I accidentally hit \ before enter suddenly I'm getting hundreds of compile errors. I had this in my code:
for(i=0;i<MAX_MODULES;i++) // initialize all twenty (x3) possible thermocouple names\
Removing the trailing slash fixed it. If you're allowed to continue a comment with \ like you can a define, then dev-cpp just isn't coloring it right (the next line still shows up black). If \ doesn't continue a comment, then I'm thoroughly confused.
>> it seemed inconsistent to color the text one way and interpret it another.
It is inconsistent, but that is not surprising. The IDE and the compiler are not the same thing, they are independently developed (one by Bloodshed, the other by GNU). The parser required for colour highlighting is not that used by the compiler.
In all other respects I agree. It seems likely that the developer did not have a thorough knowledge of the language semantics - at least not to the level required to write a compiler.
Bugs are submitted via the "Tracker" menu at the top of this page. There you can see all the others that may take priority over yours. Dev-C++ development is not particularly active at present, but that may change. The wxDev-C++ team (a Dev-C++ derivative work) may take up the issue, it is a more active project at present.
\ is the escape sequence introducer, it causes the next character to be ignored or interpreted differently. In this case it causes the <newline> to be ignored, so that the following line is appended to the current one, in this case making the following line part of the comment, which may or may not cause a problem depending on what gets commented out - it may or may not render the rest of the code nonsense.
The 'line continuation' feature is typically used when defining complex macros across several lines (because pre-processor macros must be defined on one line). Such macros are usually ill-advised in any case, so you would not use it very often.
The upshot is that \ knows nothing about where it is used, it simply escapes the following character, and this is used typically for macros, but is active regardless and independent of the context in which it is used.
It is a nasty feature at best, if the \ were followed by whitespace other than <newline> for example, it would cease to escape the <newline>, but would be very hard to spot!
Clifford
In that case it seems like a bug in the IDE. I have some of those ill-advised multi-line macros :) and it colors each line green as it should. But when the escape character is used at the end of a // comment (blue in my case), the following line, which becomes part of the comment, is still black rather than blue.
I would suggest that is is an oversight rather than a bug. The syntax highlighter has obviously been developed with the 'normal' usage in mind only, and has restricted the continuation character to use in macros so far as colouring is concerned. Feel free to submit a bug report via the link above, but it seems a trivial issue, I doubt it will get high on the priority list.
The usage in you example was in fact a bug in your code, it is perhaps not the job of the highlighter to detect bugs, but I concede it should perhaps accurately reflect the syntax of your code, which might as a consequence help detect the bug. If you genuinely want multi-line comments then the /.../ delimiters should be used.
I checked and Visual Studio 2005 correctly colours the code. If this really irks you, Dev-C++ is probably not the tool for you, it has many more serious flaws; use the free VC++ 2005 Express Edition instead.
Clifford
I was just pointing out that it seemed inconsistent to color the text one way and interpret it another. The main benefit of fixing the 'oversight' would just be to help people like me find their bugs faster (and isn't that really the point of coloring in the first place?). I would have noticed my error right away if the next line had been comment-color instead of black. It doesn't irk me because I didn't write Dev-C++. If it were my own effort, THEN it would irk me to leave it alone. :)