Page 1 of 1

OSDK: Problems with C/C++ intermixed comments

Posted: Tue Sep 12, 2006 10:08 pm
by Dbug
Ok, I found out the problem with Chema's code.
It's actually quite classic (I got the same problem in my own parser some years ago). All is due to this:

Code: Select all

//*******************************************
// Tile information generated by wcgraph.
// DO NOT edit by hand
//*******************************************
XA does not really handle C++ comments. Let's say that it's handled at linker level... but the files that are directly treated by XA are not supposed to have C++ comments at all...

In this particular case we got something vicious:

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

this is not considered as a C++ "//" comment folloed by a bunch of "***"... for XA it's "/" followed by a "/*" (C opening block comments)... and XA indefinitively wait for a matching "*/" to close the bloc... effectively skiping everything in the scope of the file, and get back to the parent file without having actually done anything.

As a temporary solution until I fix the parser, I propose to replace by this:

Code: Select all

/*******************************************
 Tile information generated by wcgraph.
 DO NOT edit by hand
*******************************************/

Re: OSDK: Problems with C/C++ intermixed comments

Posted: Wed Sep 13, 2006 9:17 am
by Chema
Dbug wrote:Ok, I found out the problem with Chema's code.
It's actually quite classic (I got the same problem in my own parser some years ago). All is due to this:

Code: Select all

//*******************************************
// Tile information generated by wcgraph.
// DO NOT edit by hand
//*******************************************
XA does not really handle C++ comments. Let's say that it's handled at linker level... but the files that are directly treated by XA are not supposed to have C++ comments at all...

In this particular case we got something vicious:

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

this is not considered as a C++ "//" comment folloed by a bunch of "***"... for XA it's "/" followed by a "/*" (C opening block comments)... and XA indefinitively wait for a matching "*/" to close the bloc... effectively skiping everything in the scope of the file, and get back to the parent file without having actually done anything.

As a temporary solution until I fix the parser, I propose to replace by this:

Code: Select all

/*******************************************
 Tile information generated by wcgraph.
 DO NOT edit by hand
*******************************************/
Thanks for the quick response DBug! I should have imagined it was related with the comments... Better will change them all to standard C type.

Thanks indeed!