From 359640943bcf155faa9a067dde9e00a123276290 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 13 Feb 2012 17:43:39 -0600 Subject: Automated update from Qt3 --- doc/html/debug.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'doc/html/debug.html') 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.
  • Q_ASSERT(b) where b is a boolean expression, writes the warning: "ASSERT: 'b' in file file.cpp (234)" if b is FALSE. -
  • Q_CHECK_PTR(p) where p is a pointer. +
  • TQ_CHECK_PTR(p) where p is a pointer. Writes the warning "In file file.cpp, line 234: Out of memory" if p is 0. @@ -91,7 +91,7 @@ Writes the warning "In file file.cpp, line 234: Out of memory" if p is { Q_ASSERT( size > 0 ); char *p = new char[size]; - Q_CHECK_PTR( p ); + TQ_CHECK_PTR( p ); return p; } @@ -101,21 +101,21 @@ instead of warning(), so a failed assertion will cause the program to exit after printing the error message.

    Note that the Q_ASSERT macro is a null expression if 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 QT_CHECK_NULL is +executed. Similarly TQ_CHECK_PTR is a null expression if QT_CHECK_NULL is not defined. Here is an example of how you should not use Q_ASSERT and -Q_CHECK_PTR: +TQ_CHECK_PTR:

       char *alloc( int size )
       {
           char *p;
    -      Q_CHECK_PTR( p = new char[size] ); // WRONG!
    +      TQ_CHECK_PTR( p = new char[size] ); // WRONG!
           return p;
       }
     

    The problem is tricky: 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 alloc returns a wild pointer.

    The TQt library contains hundreds of internal checks that will print @@ -154,7 +154,7 @@ define QT_NO_CHECK.

    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 moc, 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 vtbl, -- cgit v1.2.3