20-11-2015, 10:34 AM
Does this code violate rule 19.1?
My static code checker thinks it is a violation, but from my point of view I'm just assigning one member of a struct to a different member of the struct and they don't overlap in memory. That this struct is a member of a union should not matter as there is no assignment across the members of the union.
Code:
struct s_tag {
uint8 ReadPos;
uint8 WritePos; };
typedef struct s_tag s;
union u_tag {
s Elements;
uint32 Value; };
typedef union u_tag u;
u NewState;
NewState.Elements.ReadPos = NewState.Elements.WritePos;
<t></t>