C: PAdding:PULKIT sir
3 posters
Page 1 of 1
C: PAdding:PULKIT sir
Why are staructures padded in multiples of 4
why not in multiples of 3 or 5 etc???
why not in multiples of 3 or 5 etc???
ballu- Posts : 58
Join date : 2009-02-01
Re: C: PAdding:PULKIT sir
we can never say that structures are padded in multiples of 4...
padding is purely compiler dependent....
and compiler pads structures for faster execution of codes as padding allows to keep everythin in a proper fashion that helps in easy and fast access of data...
padding is purely compiler dependent....
and compiler pads structures for faster execution of codes as padding allows to keep everythin in a proper fashion that helps in easy and fast access of data...
$corpion- Posts : 25
Join date : 2009-01-30
Age : 37
@scorpion
right ...
but when we talk about gcc it does pad in multiples of 4
why only multiples of 4
but when we talk about gcc it does pad in multiples of 4
why only multiples of 4
ballu- Posts : 58
Join date : 2009-02-01
Re: C: PAdding:PULKIT sir
Most modern CPUs perform best when fundemental types, like 'int' or 'float', are algined on memory boundarys of a particular size (eg. often a 4byte word on 32bit archs). Many architectures don't allow misaligned access or if they do inccur a performance penalty
/* copy paste mara hai but i am not confirmed whether this answer is satisfatory or not*/
/* copy paste mara hai but i am not confirmed whether this answer is satisfatory or not*/
mnnit.rahul- Posts : 51
Join date : 2009-02-01
Similar topics
» WHY HEAP?? Pulkit Sir..
» NULL,0,'\0':Pulkit Sir
» C:FREE vs C++ Delete -Pulkit Sir
» bipartite graph- TAGDAAA : Pulkit Sir
» C:Nested Function Declarations Not allowed:Pulkit Sir
» NULL,0,'\0':Pulkit Sir
» C:FREE vs C++ Delete -Pulkit Sir
» bipartite graph- TAGDAAA : Pulkit Sir
» C:Nested Function Declarations Not allowed:Pulkit Sir
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|