Community
cancel
Showing results for 
Search instead for 
Did you mean: 
SergeyKostrov
Valued Contributor II
438 Views

Remark #9: nested comment is not allowed

Jump to solution
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
438 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

8 Replies
TimP
Black Belt
438 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.
SergeyKostrov
Valued Contributor II
438 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

Georg_Z_Intel
Employee
438 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
ILevi1
Valued Contributor I
438 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.

SergeyKostrov
Valued Contributor II
438 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.
SergeyKostrov
Valued Contributor II
438 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
SergeyKostrov
Valued Contributor II
438 Views
Here is a screenshot:


Georg_Z_Intel
Employee
439 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

Reply