02-07-2013 02:05 PM
Here's a little something that everyone should watch out for. If you put a backslash at the end of a C++ style comment the compiler will consider the next line as part of the comment and will ignore it. I believe this is perfectly valid behavior, but CVI's syntax highlighting doesn't show that line as being part of the comment so this can lead to some non-obvious bugs where lines of code appear to be "skipped over" in the debugger.
Here's a screenshot of some sample code in CVI. Note that in this example the line b = 2 will not be compiled:
Here's the same code copied into Notepad++ with its syntax highlighting:
02-08-2013 09:45 AM
Hi tstanley,
As you mentioned in the first part of your comment, this is expected behavior. If you put a line continuation symbol \
at the end of a line, it effectively merges the two lines together. If you have a //
comment block in the first line, that effectively causes the entire second line to also be part of the comment. If you add any character after the \
symbol, it will no longer act as a line continuation symbol, and you won't have this problem.
Alternatively, you can use the /*Comment\ */
comment structure, and this error will not occur.
I hope this clears things up.
Warm Regards,
02-08-2013 11:30 AM
I wouldn't normally end a comment on a backslash like that, but I did it by accident - with the backslash key next to the ENTER key it's all too easy to fat-finger it. Since CVI's syntax highlighter doesn't show the next line as a comment in this case it left me with a real head-scratcher until I realized what was going on. A search of the project revealed one other place where that had happened, though luckily the resulting bug was minor. It's just something to watch out for.
02-08-2013 11:41 AM
Hi tstanley,
Thank you for your feedback! I have filed this as a syntax highlighting bug in our system. The syntax highlighting feature should include this.
Warm Regards,
07-30-2021 03:02 AM
I just encountered this bug with CVI 2017 version 17.0.0 (295)
I wonder if this bug is still present in later versions...
Very annoying bug!
07-30-2021 05:19 AM
I just want to highlight that if you enable "Comment" warning in the build options you will be notified in case a backslash exists in a c++-style comment line