Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Equivalent in CC for cc's __attribute__((aligned((8)))

807575Sep 4 2009 — edited Sep 8 2009
I want to read 3rd party genaterated binary data e.g.
struct t_simple_str
{
     char c;
     double d;
};
where d has an offset of 8 byte.

Using SunStudio's 12U1 cc 32-bit compiler on Linux the default offset of d is 4 but with
struct t_simple_str
{
	char c;
	double d __attribute__((aligned(8)));
};
I can achieve that th double is recognized at the correct offset.

Since I have to use the C++ compiler that doesn't support __attribute__((aligned(8)))
I want to know if there is a equivalent feature that calculates the correct offset.

I did some unsuccessful tests with #pragma align 8 (...)
but according documentation it doesn't work on local variables.

Can anybody give me a hint?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2009
Added on Sep 4 2009
2 comments
189 views