P
pragma
humm, thank you regis. I was wrong about the equal sign, posed that in
general the padding will be always there.
---mauricio
general the padding will be always there.
---mauricio
Naresh said:And about the sequence
char, int, long, double..
char (3 padding), int (2 padding if sizeof (int) == 2), long, double ==
20
but what i'm getting is 24. What could be the reason?
Naresh said:Okk, i understood. Since after allocation to long, it points to word
align byte and the next element takes double word(8 bytes). So the
padding of one more word (4 bytes) is required to make it double word
align and hence the sum becomes 1+ (3) + 4 + 4 + (4) + 8 = 24.
I hope this is the solution.
Abdo said:Any logical reason for this? I always use floats, especially if I don't
need the extra precision of double, also many third part libraries
(Like DirectX and OpenGL) use them...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.