diff options
author | Timothy Pearson <[email protected]> | 2012-02-13 17:43:39 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-02-13 17:43:39 -0600 |
commit | 359640943bcf155faa9a067dde9e00a123276290 (patch) | |
tree | fb3d55ea5e18949042fb0064123fb73d2b1eb932 /doc/debug.doc | |
parent | a829bcdc533e154000803d517200d32fe762e85c (diff) | |
download | tqt3-359640943bcf155faa9a067dde9e00a123276290.tar.gz tqt3-359640943bcf155faa9a067dde9e00a123276290.zip |
Automated update from Qt3
Diffstat (limited to 'doc/debug.doc')
-rw-r--r-- | doc/debug.doc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/debug.doc b/doc/debug.doc index 6047582ab..91ec8af25 100644 --- a/doc/debug.doc +++ b/doc/debug.doc @@ -99,7 +99,7 @@ Two important macros are: \i \link ::Q_ASSERT() Q_ASSERT(b)\endlink where b is a boolean expression, writes the warning: "ASSERT: 'b' in file file.cpp (234)" if b is FALSE. -\i \link ::Q_CHECK_PTR() Q_CHECK_PTR(p)\endlink where p is a pointer. +\i \link ::TQ_CHECK_PTR() TQ_CHECK_PTR(p)\endlink where p is a pointer. Writes the warning "In file file.cpp, line 234: Out of memory" if p is 0. \endlist @@ -110,7 +110,7 @@ These macros are useful for detecting program errors, e.g. like this: { Q_ASSERT( size > 0 ); char *p = new char[size]; - Q_CHECK_PTR( p ); + TQ_CHECK_PTR( p ); return p; } \endcode @@ -121,22 +121,22 @@ exit after printing the error message. Note that the Q_ASSERT macro is a null expression if \c QT_CHECK_STATE (see below) is not defined. Any code in it will simply not be -executed. Similarly Q_CHECK_PTR is a null expression if \c QT_CHECK_NULL is +executed. Similarly TQ_CHECK_PTR is a null expression if \c QT_CHECK_NULL is not defined. Here is an example of how you should \e not use Q_ASSERT and -Q_CHECK_PTR: +TQ_CHECK_PTR: \code char *alloc( int size ) { char *p; - Q_CHECK_PTR( p = new char[size] ); // WRONG! + TQ_CHECK_PTR( p = new char[size] ); // WRONG! return p; } \endcode The problem is tricky: \e p is set to a sane value only as long as the correct checking flags are defined. If this code is compiled without -the QT_CHECK_NULL flag defined, the code in the Q_CHECK_PTR expression is +the QT_CHECK_NULL flag defined, the code in the TQ_CHECK_PTR expression is not executed (correctly, since it's only a debugging aid) and \e alloc returns a wild pointer. @@ -179,7 +179,7 @@ Example: \section1 Common bugs There is one bug that is so common that it deserves mention here: If -you include the Q_OBJECT macro in a class declaration and run the +you include the TQ_OBJECT macro in a class declaration and run the \link moc.html moc\endlink, but forget to link the moc-generated object code into your executable, you will get very confusing error messages. Any link error complaining about a lack of \c{vtbl}, |