backward/forward binary compatibility checker
Thiago Macieira
thiago at kde.org
Thu Jul 30 21:57:06 BST 2009
Matthew Woehlke wrote:
>> - uint q_skiptable[256];
>> + union {
>> + uint dummy[256];
>> + struct {
>> + uchar q_skiptable[256];
>> + const uchar *p;
>> + int l;
>> + } p;
>> + };
>>
>> As you can see, the size holds the same, at
>> sizeof(QByteArrayMatcherPrivate *) + sizeof(QByteArray) +
>> 256*sizeof(int) = 4 + 4 + 1024 = 1032. I have no clue how it came up
>> with 1024, since there's no addition that would result in that.
>
>If you assume that the 'changed from' is backwards (old was 1024, new is
>1032), that sure looks right to me (for 32-bit systems)... the old is
>obviously 1024 bytes, the new is a struct containing a 1024-byte member,
>a pointer, and a 4-byte member = 1032 bytes.
>
>Am I missing a way to pack the three members of that struct (one of
>which is 1024 bytes by itself) into 1024 bytes?
I think you're misreading.
sizeof(uint) = 4 => sizeof(uint[256]) = 1024
sizeof(uchar) = 1 => sizeof(uchar[256]) = 256
If you add one pointer (4) and one int (4) to 256, you get 264 bytes. The
size of the union is still 1024 then, matching the 4.4 member of that
size.
If you add the other two members of QByteArrayMatcher, you get 1032 bytes
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090730/fb7fda56/attachment.sig>
More information about the kde-core-devel
mailing list