Results 1 to 2 of 2

Thread: What is the displayed "value" of a pointer in the debugger?

  1. #1
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default What is the displayed "value" of a pointer in the debugger?

    Hi,
    I'm using QtCreator to debug a program. I have an issue with the display of pointers when using QtCreator to debug a program.
    I simplified my program to this:

    #include <QCoreApplication>
    #include <stdio.h>

    int main(int argc, char *argv[])
    {
    QCoreApp a(argc, argv);

    int **parray = new int *[5];
    printf("parray is %p\n",parray);
    for(int i = 0; i < 5; i++)
    parray[i] = new int[5];

    return a.exec();
    }

    Now if I put a breakpoint on the line return
    a.exec();
    the debugger reports parray as having value 0 in the pane where it reports the value of all local variables.
    This looks strange as the printf indicates the pointer is not null (as you would expect).

    My allocation looks ok, so what is the 0 referring to?

  2. #2
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What is the displayed "value" of a pointer in the debugger?

    In fact the problem appears with just this:

    int *p = new int[5];
    // the value of p is displayed as zero
    The problem arises in my Linux version of QtCreator, but not in MinGw (under windows).
    I wonder if this is not a bug.

Similar Threads

  1. Replies: 8
    Last Post: 23rd December 2012, 17:50
  2. Replies: 2
    Last Post: 10th August 2012, 19:41
  3. Replies: 4
    Last Post: 3rd November 2011, 08:30
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. Convert Windows "HWND" to QWidget* pointer?
    By gerome69 in forum Qt Programming
    Replies: 4
    Last Post: 20th September 2006, 13:03

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.