Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


GCC question on #pramga pack

I use the arm cross compiler gcc 2.95
Struct definition in the top of the document has been added #pramga pack (1)
When the structure can be used in the structural problems encountered
[code]
#pramga Pack (1)
Struct a_t{
Char a1;
Char a2;
Char a3;
Char a4;
Char a5;
Char a6;
};
Struct b_t{
Char b1;
Struct a_t a;
Char b2
Save_me;)
[/code]
Assuming the address is 0 save_me.b1
The address is then save_me.b2 0+1+sizeof (structa_t) = 7
However, the compiler I use the cheaper procedure is the address shown b2 9 : (
I estimate compiler for the 'structure of the structure of' the four automatic byte alignment
A Dadaist know how to solve this problem?

BTW
This problem does not exist in the standard gcc 4.0
Do I have to change the compiler Mody

You look up your compiler manual.
What is needed option.

I have not used that # get broad directives, the definition of the struct insert __attribute__ ((packed)), which is the total?

Two less than successful referral
Gcc4.0 found in the manuals of the parameters' -fpack-struct '
2.95 in the cross compiler that has bred support
Oh Oh. . . . . .
We try playing

Struct a_t{
Char a1;
Char a2;
Char a3;
Char a4;
Char a5;
Char a6;
) __attribute__ ((Packed));
Struct (b_t
Char b1;
Struct a_t a;
Char b2;
Save_me);

Btw, I know they will not do so, causing me a bit : D

I heard the landlord's signature is :

Trembling on the basic bath

__attribute__ ((Packed))
Is this not so?
Not right

-->

Really so Jerusalem
: Oops :
I only __attribute__ ((packed)); Not there on save_me
Now, I have placed this in each of the struct
#pragma Pack (1) The deletion of the things I

BTW
So bad that the translation parameters
Fortunately, small procedures
If the system used in some old mistakes on the struct

#pragma Pack (1) The things I delete?
I do not know whether to talk about its uses

-->

Single byte alignment structure, according to the elements.



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com