Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Remark #9: nested comment is not allowed

SergeyKostrov
Valued Contributor II
2,882 Views
I detected a small issue related to comments in a C++ source file:

void main( void )
{
//******************************
}

...
....cpp( nnn ): remark #9: nested comment is not allowed
...

I would like to note that this is not a nested comment. This is a single-line'//' comment followed by a set of characters '*'.

My environment:

OS: Windows XP 32-bit
IDE: Visual Studio 2005 SP1
C++ compiler: Intel C++Composer XE 2011 Update 9

Best regards,
Sergey

0 Kudos
1 Solution
Georg_Z_Intel
Employee
2,882 Views
Hello Sergey,

I'm able to reproduce your finding now and agree that this remark should not show up here. Hence I've created a ticket for engineering (DPD200285580).

Thank you & best regards,

Georg Zitzlsberger

View solution in original post

0 Kudos
8 Replies
TimP
Honored Contributor III
2,882 Views
If this happens with standard code (not with Microsoft syntax which violates the standard) and does not happen with the Microsoft compiler, your complaint would look more compelling.
0 Kudos
SergeyKostrov
Valued Contributor II
2,882 Views
Quoting TimP (Intel)
If this happens with standard code (not with Microsoft syntax which violates the standard) and does not happen with the Microsoft compiler, your complaint would look more compelling.


It doesn't happen with any Microsoft C/C++ compilers or another C++ compilersused on the project.

Here ismore information for the case ( '//**********************' ):

- Intel C++ compiler - Reported as a nested comment
- Microsoft C++ compiler ( VS98 / VS2005 / VS2008 / VS2010 ) - Not reported
- MinGW C++ compiler - Not Reported
- Borland C++ compiler - Not reported
- Turbo C++ compiler - Not reported

0 Kudos
Georg_Z_Intel
Employee
2,882 Views
Hello Sergey,

I tried to reproduce this problem and I'm not seeing this remark - even with warning level of 5.

Could you provide me a small Microsoft* Visual Studio 2005 solution?

Thank you & best regards,

Georg Zitzlsberger
0 Kudos
levicki
Valued Contributor I
2,882 Views
I cannot reproduce this with Intel Parallel Composer Update 9 (Version 12.1.3.102).

However, there is a parsing bug if you do this:
[cpp]/* int main(int argc, char *argv[]) { //*************************/ return 0; } */ [/cpp] Compilation fails with:

test.cpp
test.cpp(5): error: expected a declaration
return 0;
^

test.cpp(6): error: expected a declaration
}
^

compilation aborted for test.cpp (code 2)

I am not sure what the standard says about it but I personally think that it should not happen because everything on a line after // should be treated as a line comment, and compiler mistakenly interprets */ at the end of the line as a closing tag for the current block comment.

Unfortunately both Visual Studio 2010 and GCC 4.5.3. have the same bug so I doubt anyone would want to fix it.

0 Kudos
SergeyKostrov
Valued Contributor II
2,882 Views
Hi Georg, Please try the following Test-Case:

...
#define _REMARK9
#undef _REMARK9

void main( void )
{
#if _REMARK9

//***************

#endif
}
...

Best regards,
Sergey

UPDATED: Please use a Test-Case from a Post #6.
0 Kudos
SergeyKostrov
Valued Contributor II
2,882 Views
Hi everybody,

Here is updated Test-Case that reproduces a 'remark #9' messageat aWarning Level 4:

[cpp] #define _REMARK9 #undef _REMARK9 #if _REMARK9 // Sub-Test for "remark #9" message { /* //******************************* */ } #endif [/cpp]
Best regards,
Sergey
0 Kudos
SergeyKostrov
Valued Contributor II
2,882 Views
Here is a screenshot:


0 Kudos
Georg_Z_Intel
Employee
2,883 Views
Hello Sergey,

I'm able to reproduce your finding now and agree that this remark should not show up here. Hence I've created a ticket for engineering (DPD200285580).

Thank you & best regards,

Georg Zitzlsberger
0 Kudos
Reply