This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I would like to ask a question on enum on C6000 compiler.
A declaration following definition of enum type and variable, which are completely legal in Visual Studio 2008, got error on C6000 compiler.
I have also tried the -kr_compatible option but it didn't solve the problem.
Why this happens and how should I solve it?
Zheng
Zheng Zhao said:Is enum deprecated for some reason in C6000 compiler? Why is it not used?
No, the compiler is not in error.
The code you have presented is valid C++ code, but it is not valid C code. No doubt you are operating Visual Studio in C++ mode.
You need to declare this variable as follows, or else use C++ mode:
enum fruit mine = apple;
Another way to handle that in C is to use a typedef:
typedef enum fruittag { apple, orange } fruit;
fruit mine = apple;
enum fruittag yours = orange;
The fruittag identiifer is optional.
Archaeologist and Norman,
Both your solutions worked, thanks very much.
Archaeologis,
How to turn on C++ mode? Embedded C++ attempts to trim standard C++ to meat performance requirements of embedded applications, which at least shows that C++ might be slower or require more resources than C. I think it is true due to its inheritance, polymorphism and other features. How slow is C++ comparing with C on embedded processors? Are TI software packages {BIOS and others} written in C or C++?
Zheng
Zheng Zhao said:How to turn on C++ mode?
That is the default for files with extension .cpp. Or you can use the options --cpp_default or --cpp_file filename.
Zheng Zhao said:Are TI software packages {BIOS and others} written in C or C++?
Most TI software packages, BIOS included, are implemented in C and assembly. I'm sure there is a C++ package or two out there, but I can't think of any.
For all other questions about C++, please see this wiki article.
Thanks and regards,
-George