On Tue, 19 Jun 2001, Philip Andrew Ferguson wrote:

> Hello All,
> 
> I have a quick question.  What are the sizes of the following variable
> types in the ARM architecture?
> 
> int
> long int
> short int
> float
> double
> char

For a quick reference:
try asking sizeof() ;-)

int: 4
long int: 4
long long int: 8
short int: 2
float: 4
double: 8
char: 1
char*: 4

But beware: structures have their own alignment rules!

Generally, structures are multiples of 4 bytes in size
and start on a 4 byte boundary.
The alignment of members within the structure depends on the
previous ones:
a new struct member starts at a boundary that is equivalent to it's
alignment requirements.
That is: a char may start at a byte boundary, a short will start on the
next even byte and larger types at the next new word.

There may be "holes" in the struct, like in the following example:
struct foo {
        char foo1;
                /* here is a 3 byte hole */
        int  foo2;
                /* this fits well */
        char foo3;
                /* here comes a hole as well */
        short foo4[3];
                /* and here will be 2 bytes to close the struct */
}

Hope this helps.

sh


_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.

Reply via email to