On Saturday 09 June 2012 17:45:01 Thiago Macieira wrote:
> Hello
>
> Moving the discussion from the series of patches I've begun on Gerrit to the
> ML.
>
> tl;dr: all I wanted was to add the prepend optimisation to QVector so I
> could work on QList. Then João told me of a request by Tor Arne about
> letting QString have a "notify of destruction" function. So I changed the
> internals of QArrayData again.
I suggest re-ordering the offset in order to avoid padding.
struct Q_CORE_EXPORT QArrayData
{
QtPrivate::RefCount ref;
uint flags;
qptrdiff offset; // in bytes from beginning of header
int size; // ### move to the main class body?
// 4 byte tail padding on 64 bits
};
// size is 16 / 24 bytes (but really 20 bytes as we could use the tail padding
to put the payload already)
struct QArrayAllocatedData : public QArrayData
{
uint alloc;
};
// size is 20 / 24 bytes (the tail padding bytes are used)
struct QArrayForeignData : public QArrayData
{
void *token;
void (*notifyFunction)(void *);
// size is 24 / 40 bytes
};
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development