TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: andrew clarke
from: Jasen Betts
date: 2003-08-07 18:15:56
subject: Bob`s questi

Hi andrew.

06-Aug-03 02:21:30, andrew clarke wrote to Jasen Betts


 ac> Sun 2003-08-03 22:31, Jasen Betts (3:640/1042) wrote to Bill Birrell:

 JB>> I have a question: -  something that came up in the C++ echo recently

 JB>> Given

 JB>> typedef struct moo
 JB>>   {
 JB>>  int foo;
 JB>>  char bar;
 JB>>   } moo;

 JB>> is   sizeof(moo) * 100   always the same as   sizeof( moo[100] )

 ac> moo[100] is not valid, but I think you mean:

My compilers don't complain... are you shure?

 ac> moo amoo[100];

 JB>> in other words does sizeof() include any slack space required for
 JB>> alignment.

 ac> Structure padding is between structure members, not array elements, eg.

so in this case the structure is padded at the end if alignment is turned on.
ah, thanks...

 -=> Bye <=-

---
* Origin: Entropy isn't what it used to be. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.