Hello All!
Usually I develop embedded code using C-code without any C++ files.
Nevertheless recently I've decided to use C++.
I don't need classes, overloading, etc., - just some basic C++ features like namespaces and pointers to the type defined later (for linked lists).
Now I have an issue which I'd like to fix:
C++ doesn't allow me to assign one structure to another.
For example:
typedef struct t_struct { int a; } t_struct;
t_struct b, c;
b.a = 1;
a = b; // error! don't know how to assign...
The same code is successfully compiled by a Microsoft compiler.
In addition it is successfully compiled if using C instead of C++.
I'm using C6000 compiler v.6.1 but I think it may be a common issue for TI's compiler.
I suppose that TI's compiler considers structures as C++ structures (with member-functions) but doesn't generate default copying constructors.
Thus it cannot assign structures even if they're of the same type.
Right now I overcome this problem by manual copying of the separate structure fields, but it isn't convenient and may be dangerous if structure type is changed.
Is it possible to make C++ consider a structure as C-structure, or to make it generate copying constructor correctly?