On Saturday 09 January 2016 17:30:37 Denis Shienkov wrote:
> E.g. we can look on
> \qtbase\tests\auto\network\socket\qtcpsocket\tst_qtcpsocket.cpp as example,
> where in each test are used the new/delete:
>
> void tst_QTcpSocket::foo()
> {
> QTcpSocket *socket = new QTcpSocket;
> // make tests
> delete socket;
> }
Because they are not like that.
Here's an actual copy/paste from the test:
void tst_QTcpSocket::waitForReadyReadInASlot()
{
QTcpSocket *socket = newSocket();
[... other code ...]
delete socket;
}
What's the difference?
QTcpSocket *tst_QTcpSocket::newSocket() const
{
QTcpSocket *socket;
#ifndef QT_NO_SSL
QFETCH_GLOBAL(bool, ssl);
socket = ssl ? new QSslSocket : new QTcpSocket;
#else
socket = new QTcpSocket;
#endif
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development