|
|
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Assist++ typedef struct analysis problem
Assist++ typedef struct analysis problem [message #58216] |
Sun, 27 March 2022 00:49 |
|
Xemuth
Messages: 387 Registered: August 2018 Location: France
|
Senior Member |
|
|
Hello U++,
I noticed that Assist++ fail to parse some struct. Lets take a look at thoses 4 structs def:
test.h:
#ifndef _test_assist_test_h_
#define _test_assist_test_h_
typedef struct StructToResolve {
uint32_t engineVersion;
uint32_t apiVersion;
} StructToResolve;
typedef struct StructToResolve2 {
uint32_t engineVersion;
uint32_t apiVersion;
};
//Illegal but we test Assist++ here !
struct StructToResolve3 {
uint32_t engineVersion;
uint32_t apiVersion;
} StructToResolve3;
struct StructToResolve4 {
uint32_t engineVersion;
uint32_t apiVersion;
} test;
#endif
All four struct are found by assist++. However, auto completion don't work on the first.
Moreover having a struct having a name at begining and variable declaration with the same name are shown has two different struct by Assist++.
test.cpp
#include "test.h"
int main(int argc, const char *argv[])
{
StructToResolve str;
str. // Assist++ don't find anything. It don't even open
StructToResolve2 str2;
str2.engineVersion; // work fine
StructToResolve3 str3;
str3.apiVersion; // Work fine BUT doing a Ctrl+ Space during writting of this type result in 2 distinct StructToResolve3 type. See the screenshot
StructToResolve4 str4;
str4.engineVersion; // Work fine BUT ...
return 0;
}
this bug is problematique when working with lib definition a huge amount of the structure which have the same declaration as the first one.
[Updated on: Mon, 28 March 2022 08:58] Report message to a moderator
|
|
|
|
Re: Assist++ typedef struct analysis problem [message #58218 is a reply to message #58217] |
Sun, 27 March 2022 03:54 |
Lance
Messages: 633 Registered: March 2007
|
Contributor |
|
|
BTW, xemuth's example code
is not legal C/C++ code: it won't compile.
It should be
struct StructToResolve3 str3;
And the following code compiles
struct C{
void hi(){}
};
struct D{
void hi(){};
};
int main()
{
C D;
struct D d; // the keyword struct cannot be done without
D.hi();
d.hi();
}
or this also compiles
struct C{
void hi(){}
};
struct D{
void hi(){};
};
int main()
{
D d;
C D;
D.hi();
d.hi();
}
Conclusion: in a context where a class/struct name is used as identifier(and hence hidden by it), to refer to the class/struct, a leading classor struct keyword needs to be prepended.
[Updated on: Sun, 27 March 2022 03:55] Report message to a moderator
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Dec 14 15:30:26 CET 2024
Total time taken to generate the page: 0.02434 seconds
|
|
|