[Development] Meaning of Q_PRIMITIVE_TYPE?

Thiago Macieira thiago.macieira at intel.com
Fri Mar 30 20:35:40 CEST 2012


On sexta-feira, 30 de março de 2012 18.41.46, Olivier Goffart wrote:
> On Friday 30 March 2012 12:23:59 Thiago Macieira wrote:
> > Use of QVarLengthArray should *only* be done with primitive types, the
> > fixes applied to it during Qt 4.x lifetime notwithstanding. So the user
> > must know that before he uses that class. If he's not sure, use QVector.
> 
> That is wrong.  QVarLenghtArray can be use with every types.

That statement ^^^

> > Also, QVarLengthArray should zero-initialise, but it doesn't.
> 
> It is documented not to.

And this statement ^^^

Are in contradiction. If it doesn't zero-initialise, then it doesn't 
initialise. Then using it for non-PODs is dangerous.

If it supports any type, then it must initialise them all.

> But yes, it probably should.  (we can add a Qt::Uninitialized overload if we
> need it)

I'd rather we removed support for non-primitives. The class wasn't designed 
for that.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120330/b5703de4/attachment.sig>


More information about the Development mailing list