Problem
I have code that includes comments of the style:
// This is a commentin my sources. The icc compiler does not understand this type of comment.
Cause
The icc compiler enforces strict ANSI and ISO c compliance and the
// This is a commentstyle of comment is not compliant with these standards. The
// This is a commentstyle of comment may result in valid c (ansi and k&r) code being compiled incorrectly. Do not use this style of comment in your c code.
Solution
A feature request has been filed to add support for the // style of comment in a future release of product.
Currently the only solution is to convert your source comments to the
/* This is a comment */style of comment.The filter program enclosed below can be used to do this.
/* Usage: a.out < test.c > test.out */
#include <stdio.h>#define TRUE 1
#define FALSE 0typedef char Boolean;main(int argc, char *argv[]) { int c, d; Boolean Comment = FALSE;
while ((c = getchar()) != EOF)
{
switch (c)
{
case '/':
if ((d = getchar()) == EOF)
{
putchar(c);
exit(0);
} if (d == '/')
{
printf("/*");
Comment = TRUE;
}
else
{
printf("%c%c", c, d);
}
break;
case '\n':
if (Comment)
{
printf(" */");
Comment = FALSE;
}
/* DROP THRO' */
default:
putchar(c);
break;
}}
}