summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/doc_src_debug.qdoc
blob: 0e8a1c52d119c6cf6b1172965c1952e20d49c7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! [0]
qDebug() << "Widget" << widget << "at position" << widget->pos();
//! [0]


//! [1]
char *alloc(int size)
{
    Q_ASSERT(size > 0);
    char *ptr = new char[size];
    Q_CHECK_PTR(ptr);
    return ptr;
}
//! [1]


//! [2]
char *alloc(int size)
{
    char *ptr;
    Q_CHECK_PTR(ptr = new char[size]);  // WRONG
    return ptr;
}
//! [2]