I'm currently attempting to modify an automatic code generation package (designed to run with MSVC/C++, WATCOM C/C++ and Borland C) to autogenerate software compilable with the Keil CA166 package. Of the standard files which have to be included into the code, one of them contains the lines...
enum { COMPLEX_INHERITED = -1, COMPLEX_NO, COMPLEX_YES };
I also have bumped into this behavior but found like Mark stated that it was how I was using the enum that was the cause. For instance if it is used in array subscripting, the negative value would be an error. However the compiler does not always give an error that relates to the actual problem.
For instance if it is used in array subscripting, the negative value would be an error. A slight side-track here, as Jon has alrady pointed out that negative indices are not wrong per se. With C51, I have found that it will report errors on all lines containing any array reference if there is any error in any preceding line. Maybe Keil's handling of the subscript operator, [], is just particularly fragile?
View all questions in Keil forum