diff options
Diffstat (limited to 'doc/html/debug.html')
-rw-r--r-- | doc/html/debug.html | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/doc/html/debug.html b/doc/html/debug.html index c48aa6e0c..23c84dd94 100644 --- a/doc/html/debug.html +++ b/doc/html/debug.html @@ -81,7 +81,7 @@ often useful even without names. <li> <a href="ntqapplication.html#Q_ASSERT">Q_ASSERT(b)</a> where b is a boolean expression, writes the warning: "ASSERT: 'b' in file file.cpp (234)" if b is FALSE. -<li> <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR(p)</a> where p is a pointer. +<li> <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR(p)</a> where p is a pointer. Writes the warning "In file file.cpp, line 234: Out of memory" if p is 0. </ul> @@ -91,7 +91,7 @@ Writes the warning "In file file.cpp, line 234: Out of memory" if p is { <a href="ntqapplication.html#Q_ASSERT">Q_ASSERT</a>( size > 0 ); char *p = new char[size]; - <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( p ); + <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR</a>( p ); return p; } </pre> @@ -101,21 +101,21 @@ instead of warning(), so a failed assertion will cause the program to exit after printing the error message. <p> Note that the Q_ASSERT macro is a null expression if <tt>QT_CHECK_STATE</tt> (see below) is not defined. Any code in it will simply not be -executed. Similarly Q_CHECK_PTR is a null expression if <tt>QT_CHECK_NULL</tt> is +executed. Similarly TQ_CHECK_PTR is a null expression if <tt>QT_CHECK_NULL</tt> is not defined. Here is an example of how you should <em>not</em> use Q_ASSERT and -Q_CHECK_PTR: +TQ_CHECK_PTR: <p> <pre> char *alloc( int size ) { char *p; - <a href="ntqapplication.html#Q_CHECK_PTR">Q_CHECK_PTR</a>( p = new char[size] ); // WRONG! + <a href="ntqapplication.html#TQ_CHECK_PTR">TQ_CHECK_PTR</a>( p = new char[size] ); // WRONG! return p; } </pre> <p> The problem is tricky: <em>p</em> 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 <em>alloc</em> returns a wild pointer. <p> The TQt library contains hundreds of internal checks that will print @@ -154,7 +154,7 @@ define QT_NO_CHECK. <p> <h2> Common bugs </h2> <a name="4"></a><p> There is one bug that is so common that it deserves mention here: If -you include the <a href="metaobjects.html#Q_OBJECT">Q_OBJECT</a> macro in a class declaration and run the +you include the <a href="metaobjects.html#TQ_OBJECT">TQ_OBJECT</a> macro in a class declaration and run the <a href="moc.html">moc</a>, but forget to link the <a href="moc.html#moc">moc</a>-generated object code into your executable, you will get very confusing error messages. Any link error complaining about a lack of <tt>vtbl</tt>, |