[haiku-commits] Re: r39462 - in haiku/trunk: headers/os/app headers/private/app src/kits/app

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 17 Nov 2010 23:26:29 +0100

Am 17.11.2010 23:11, schrieb Siarzhuk Zharski:
Hi Rene,

Am 17.11.2010 21:42, schrieb Rene Gollent:
Bool is usually one byte, in which case the easiest thing in order to
maintain class size would've been:

uint32 _reserved[11];
char _reserved2[3];
bool fHasBeenRestored;

or alternatively:
char _reserved[47];
bool fHasBeenRestored;

BTW, are Haiku classes and structures 1-byte aligned by default?

I think the compiler may add padding as it sees fit. Since the member immediately below the added uint32 member is a bool (if memory serves), the added bool may not have changed the size of the class if the number of bools in one chunk below the added member was not dividable by four. The best is to check sizeof(BApplication) before and after the change.

Best regards,
-Stephan

Other related posts: