Altera_Forum
Honored Contributor
15 years agogcc alignment
I'm surprised. I have a C++ code that fills a char array and there seems to be an alignment problem with g++. See below:
char* response = new char;
response = 0;
unsigned int* dataSize = (unsigned int*)&response;
*dataSize = 0x08070605;The array elements, after dumping: response: 5
response: 6
response: 7
response: 8
response: 0
response: 0
...Is there something wrong with my code? I have always worked in this way without any problems. Should I fill the array using memcpy?