Tool/software: TI C/C++ Compiler
I am trying to port a project from C to C++. At least during the transition, I would like to be able to compile it in either mode so I can compare performance, memory usage, etc. so I am trying to make the code use a common subset of features that are supported in both languages. Currently the code uses designated initializers in a lot of places, which work great in C and won't compile in C++ mode (I get error "#2719: a designator for an anonymous union member can only appear within braces corresponding to that anonymous union"). I think that is most likely because the TI v20.2.0.LTS compiler I am using (which came with CCS10) supports only C++14, not C++20. I realize that C++20's support for designated initializers is limited compared with C++11, but I think I could deal with that pretty easily. Do I have any good options for making this code compile in both C and C++ modes?
- Is there a way to make the TI v20.2.0.LTS compiler support designated initializers in C++ mode?
- Is there a newer version of that compiler that supports C++ 20, or at least a schedule for when one might be available?
- Would switching to the GNU v7.2.1 (Linaro) compiler help?
- Is there another way to handle initializers that works in both C and C++ (other than the original non-designated method which just relies on the order the members were defined)?
Thanks for any suggestions.