|
-
June 2nd, 2003, 04:10 PM
#1
off set in structure or class size.
How the off set are set while allocating memory.
calss A()
{
public:
char a[10];
char b[2];
float c;
};
calss B()
{
public:
char a[10];
float c;
char b[2];
};
int aa=sizeof(A)// returns 16 bytes
int aa=sizeof(B)// returns 20 bytes
how the offsets are defined in structure and classes.
Thanks.
sanjiv
-
June 2nd, 2003, 04:18 PM
#2
It's dependent on the compiler that you use. It's rarely relevant, anyway.
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell
-
June 2nd, 2003, 05:24 PM
#3
Its configured by the "struct member alignment" settings. Search for this topic if you need more information.
-
June 3rd, 2003, 11:21 AM
#4
Thanks
Thanks mwilliamson
I got it .
sanjiv
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
|