Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Edit box selection color Pin
Rage14-Feb-06 2:22
professionalRage14-Feb-06 2:22 
GeneralRe: Edit box selection color Pin
ThatsAlok14-Feb-06 22:00
ThatsAlok14-Feb-06 22:00 
Questionsize of Objects Pin
Subramaniam s.V.13-Feb-06 20:09
Subramaniam s.V.13-Feb-06 20:09 
AnswerRe: size of Objects Pin
Cedric Moonen13-Feb-06 20:23
Cedric Moonen13-Feb-06 20:23 
GeneralRe: size of Objects Pin
Subramaniam s.V.13-Feb-06 20:38
Subramaniam s.V.13-Feb-06 20:38 
GeneralRe: size of Objects Pin
Cedric Moonen13-Feb-06 21:25
Cedric Moonen13-Feb-06 21:25 
GeneralRe: size of Objects Pin
haian244213-Feb-06 22:49
haian244213-Feb-06 22:49 
GeneralRe: size of Objects Pin
Subramaniam s.V.13-Feb-06 22:51
Subramaniam s.V.13-Feb-06 22:51 
Sorry that I got confused a bit.

I am not fully satisfied with the clarification you gave in the previous update.

Consider only 3 variables declared char(1 byte),int(4 bytes) and float(4 bytes). As you said in a 32-bit system the memory block size would be 8 bytes. In that case, the first block of 8 bytes is first allocated as soon as char variable in declared. Now, the int variable fits in and so totally 5 out of 8 bytes have been filled. The float variable cannot be accomodated in this remaining first block as only 3 bytes are remaining(since float also takes 4 bytes). So, these 3 bytes in the first block are padded(as per your information). For the float variable, another 8 block memory is allocated and only 4 of them ll be occupied. So finally, the total size should be shown as 16 bytes (even though only 12 was occupied), but it shows the value as 12 bytes only.
Could you please clarify me on the same.

I got this doubt because, assume a scenario where you have declared only an char and an int. Now, if you c the total size of the object/class it shows as 8 bytes rather than showing as 5. So, from this I concluded that even the unallocated blocks ll be accounted by the sizeof operator. what us ur opinion on this??
GeneralRe: size of Objects Pin
haian244213-Feb-06 23:01
haian244213-Feb-06 23:01 
GeneralRe: size of Objects Pin
Subramaniam s.V.13-Feb-06 23:14
Subramaniam s.V.13-Feb-06 23:14 
GeneralRe: size of Objects Pin
BadKarma13-Feb-06 23:24
BadKarma13-Feb-06 23:24 
GeneralRe: size of Objects Pin
Subramaniam s.V.13-Feb-06 23:29
Subramaniam s.V.13-Feb-06 23:29 
GeneralRe: size of Objects Pin
BadKarma13-Feb-06 23:46
BadKarma13-Feb-06 23:46 
GeneralRe: size of Objects Pin
Subramaniam s.V.14-Feb-06 0:16
Subramaniam s.V.14-Feb-06 0:16 
GeneralRe: size of Objects Pin
sunit514-Feb-06 3:16
sunit514-Feb-06 3:16 
GeneralRe: size of Objects Pin
BadKarma14-Feb-06 3:58
BadKarma14-Feb-06 3:58 
GeneralRe: size of Objects Pin
sunit514-Feb-06 18:06
sunit514-Feb-06 18:06 
GeneralRe: size of Objects Pin
Cedric Moonen14-Feb-06 1:13
Cedric Moonen14-Feb-06 1:13 
GeneralRe: size of Objects Pin
Cedric Moonen14-Feb-06 1:15
Cedric Moonen14-Feb-06 1:15 
Questiona question regarding CStringList Pin
namaskaaram13-Feb-06 19:52
namaskaaram13-Feb-06 19:52 
AnswerRe: a question regarding CStringList Pin
Subramaniam s.V.13-Feb-06 20:40
Subramaniam s.V.13-Feb-06 20:40 
Generalits the same thing! Pin
namaskaaram13-Feb-06 21:00
namaskaaram13-Feb-06 21:00 
GeneralRe: its the same thing! Pin
Subramaniam s.V.13-Feb-06 21:10
Subramaniam s.V.13-Feb-06 21:10 
GeneralRe: its the same thing! Pin
namaskaaram13-Feb-06 21:18
namaskaaram13-Feb-06 21:18 
GeneralRe: its the same thing! Pin
Subramaniam s.V.13-Feb-06 21:23
Subramaniam s.V.13-Feb-06 21:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.