source: trunk/doc/src/snippets/code/doc_src_debug.qdoc@ 244

Last change on this file since 244 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 344 bytes
Line 
1//! [0]
2qDebug() << "Widget" << widget << "at position" << widget->pos();
3//! [0]
4
5
6//! [1]
7char *alloc(int size)
8{
9 Q_ASSERT(size > 0);
10 char *ptr = new char[size];
11 Q_CHECK_PTR(ptr);
12 return ptr;
13}
14//! [1]
15
16
17//! [2]
18char *alloc(int size)
19{
20 char *ptr;
21 Q_CHECK_PTR(ptr = new char[size]); // WRONG
22 return ptr;
23}
24//! [2]
Note: See TracBrowser for help on using the repository browser.