Forum Discussion
Altera_Forum
Honored Contributor
12 years ago#pragma pack doesn't work correctly
NIOSII, eclipse For a serial communication (TCP/UDP) I use pragma pack in order to simply copy incoming bytes from the interface and map a structure on it. Long time, it worked fine, but now ...
Altera_Forum
Honored Contributor
12 years agoTry using __attribute__((aligned(1))) instead.
Although it really is best to align the data structures. To access misaligned data the compiler has to generate code to do byte memory cycles and shifts.