[Development] [autotests] Why the objects are used in 'heap' instead of 'stack'
thiago.macieira at intel.com
Sat Jan 9 16:49:33 CET 2016
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:
QTcpSocket *socket = newSocket();
[... other code ...]
What's the difference?
QTcpSocket *tst_QTcpSocket::newSocket() const
socket = ssl ? new QSslSocket : new QTcpSocket;
socket = new QTcpSocket;
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development