01-20-2020 02:42 AM - edited 01-20-2020 02:43 AM
I have noticed that LabWindows/CVI 2019 does not give "completions" on anonymous struct members.
For example, consider the following code:
typedef union {
struct _namedstruct {
double a;
double b;
} namedstruct;
double array[2];
} NAMED;
typedef union {
struct {
double a;
double b;
};
double array[2];
} ANONYMOUS;
void main()
{
NAMED named;
ANONYMOUS anon;
named.namedstruct.a = 1.0;
anon.a = 2.0;
}
when I write the first assignment I have correctly proposed on first dot both the members of the union:
and on the second dot the struct members:.
When I enter the second assignment, keying the dot I get only the named member, but not the members of the anonymous struct, as I would expect.
I found this very annoying because I use often this scheme in my code, I think it improves the readability of code.
Is this behavior wanted or is it a bug?
01-21-2020 02:41 AM
I find that anonymous structs and unions have always behaved strangely in C. It depends a lot on the compiler.