I have to create a test case where one object is copied to the other when both of the objects have some overlapping memory.
I have experimented with memmove and memcpy and the use of unions.
I am not sure how to use memmove successfully using union members.
at the momemet i have
Memmove above overlaps teh memory of one bject but i require two separate objects to be overlapped!
typedef float float32_t;
typedef int int32_t;
typedef char char_t;
char_t main(int32_t a)
char_t Buffer= "is this a violation?";
union aUnion /*Violation of Rule 18.2 and 18.4*/
union aUnion test; /*Violation of 18.4*/
memcpy(&Buffer, &Buffer, 10U); /*Possible Violation*/
a=test.x+a;/*Violation value of test.x undefined, x has been overlapped*/
IS there a way I can use the union members in memcpy and have it compile????