SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: joecar on June 02, 2021, 09:55:34 pm

Title: struct within typedef'd struct
Post by: joecar on June 02, 2021, 09:55:34 pm
Hi,

I'm seeing references to a struct within a typedef'd struct being marked as unknown symbol, see attached pic.

Code: [Select]
typedef struct lfs {
    lfs_cache_t rcache;
    lfs_cache_t pcache;

    struct lfs_mlist {
        struct lfs_mlist *next;
        uint16_t id;
        uint8_t type;
        lfs_mdir_t m;
    } *mlist;

    struct  {
        lfs_block_t off;
        lfs_block_t size;
        lfs_block_t i;
        lfs_block_t ack;
        uint32_t *buffer;
    } lfs_free;

    const struct lfs_config *cfg;
} lfs_t;

I'm using SE 25.0.2.

Thanks.
Title: Re: struct within typedef'd struct
Post by: Dennis on June 03, 2021, 03:30:52 pm
That is a difference between ANSI-C and C++ scoping.  You'll need to do a Document > Select Mode > ANSI-C for header files containing that sort of struct definition (then tickle the file and save it so it gets retagged).
Title: Re: struct within typedef'd struct
Post by: joecar on June 04, 2021, 02:16:08 am
Ok, thanks.
Title: Re: struct within typedef'd struct
Post by: Dennis on June 11, 2021, 10:05:07 pm
I found that there is also a problem with the ANSI-C parser with nested enums.

I am fixing that for the next release (v26), and also adding an option for the C/C++ tagging to treat nested structs and enums the way ANSI-C does.  That way, if you are working with mixed source, *and* you do not frequently nest structs/unions/enums within your C++ structs, you might be able to turn that option on and work fairly seamlessly, even if you have certain header files begin recognized in the wrong mode.
Title: Re: struct within typedef'd struct
Post by: joecar on June 12, 2021, 01:27:28 am
Thanks, that would help alot, I appreciate it.

  8)