|
-
April 3rd, 2007, 09:54 PM
#1
memory alignment of a struct
Hello everyone,
I heard when define a struct, it is important to make the size of the struct memory aligned.
For example,
Code:
struct foo
{
char p;
char[3] align;
};
Code:
struct goo
{
char p;
};
struct foo is better than struct goo, even if we only use member p.
Allocate 3 bytes to align with memory. But I do not know why make memory aligned is better. Any reasons? (for example, prevent memory from running out?)
thanks in advance,
George
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|