Results 1 to 2 of 2

Thread: Struct Parsing, multiple name typedef failing

  1. #1
    Join Date
    Jul 2011
    Location
    Santa Clara, CA
    Posts
    13
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Struct Parsing, multiple name typedef failing

    Typically QT Creator has an amazing C/C++ parser, but I ran into something used pretty frequently that it's choking on.

    That's a struct declared like this:

    typedef struct _a_struct
    {
    int member a;
    int member b;
    } a_struct, *a_struct_ptr;

    That is legal in C and I see it pretty often, this creates two typedefs, a typedef of the struct named "a_struct", and a type of "a_struct_ptr" which is an "a_struct" pointer.

    When used like this:
    a_struct a;
    a.<ctrl+space> it autocompletes fine

    When used like this:
    a_struct_ptr ptr;
    ptr-><ctrl+space> it doesn't autocomplete at all.

    Not sure why, I hit "F2" on a_struct_ptr and it recognizes where it was type-def'ed, so it should know what it is. Anybody have a fix for this or know what the problem is?


    Added after 1 31 minutes:


    Just for clarification, this only happens on type-def'ing multiple names when one is a pointer.

    Example:
    typedef struct _a
    {
    int a;
    } A, B;

    Works fine, as it should.

    On the other hand:
    typedef struct _a
    {
    int a;
    } A, *B;

    Does not, A will auto-complete, B will auto-complete the TYPE, but will NOT autocomplete the members, ie.
    B a_variable;
    a_variable-><ctrl+space>

    Doesn't work, but:
    A *a_variable;
    a_variable-><ctrl+space>
    OR
    A a_variable;
    a_variable.<ctrl+space>

    Both work perfectly fine.
    Last edited by Syndacate; 11th July 2011 at 20:28.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Struct Parsing, multiple name typedef failing

    Same here (Qt Creator 2.2). You may want to check if this bug is reported on Qt issue tracker (and maybe report it if it's not).

Similar Threads

  1. typedef unsigned qint32 uint32_t ?
    By nthung in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2010, 19:57
  2. typedef question
    By MarkoSan in forum Newbie
    Replies: 5
    Last Post: 29th January 2008, 08:28
  3. typedef Related doubts?
    By rajeshs in forum General Programming
    Replies: 3
    Last Post: 2nd January 2008, 19:05
  4. Typedef quint16 on ARM and Win32
    By sgrasic in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 16th May 2006, 22:27
  5. typedef static const QString Tag;
    By sunil.thaha in forum General Programming
    Replies: 13
    Last Post: 21st January 2006, 17:05

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.