Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Structures and Union

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
hezi Posted - Mar 09 2006 : 02:38:03 AM
Hi,

When defining a structure or a union and using it, I get all the fields in the project and not just the fields that are in the specific structure or union.

What can I do to fix this?

Thanks in advance,
12   L A T E S T    R E P L I E S    (Newest First)
jpizzi Posted - Apr 06 2006 : 01:04:07 AM
Not having used it without VA, I don't know. Intellisense seems to work just fine for me
feline Posted - Apr 05 2006 : 3:21:56 PM
i was reading up on the new "improved" intellisense in VS2005 C++ the other day, and one of the points they listed was that you no longer had to compile to get intellisense to work. my reading of the article was that the pdb files are built at compile time, and are required for default intellisense to work.

jpizzi did you find this? or don't you know?
jpizzi Posted - Apr 05 2006 : 12:49:09 AM
I have used VS as an editor when programming for an embedded target. You can still setup a project/solution (I know, it seems like a LOT of work when you can't compile afterwards). Then you could use the workaround. Just a thought. The case is still recorded.
feline Posted - Apr 04 2006 : 5:38:50 PM
thats unfortunate. since you cannot use this work around i have put in a case for this, but i am not sure when it will be addressed.

case=1117
hezi Posted - Apr 04 2006 : 02:20:12 AM
Hi,

I am working on embedded platforms and using the visual studio just as an editor without compiling. Since I do that I can't use the option: get content from default intellisense.
Do you think that it can be fixed in the VA so that it will recognize the types?
feline Posted - Mar 22 2006 : 3:46:23 PM
i had to removed the word "_Packed" before this would compile. i am guessing this is actually another #define somewhere in your code.

i see the problem. as far as i can tell VA does not know that "A_Type" and "B_Type" are actually types at all. for me turning on the option:

VA Options -> text editor -> listboxes -> get content from default intellisense

fixes this.
hezi Posted - Mar 22 2006 : 04:17:47 AM
Hi,

Here is the code that will show the problem:

File Test1.cpp:
#include <Test1.h>

static int getCounter(void)
{
A_Union_Type foo;

foo.A.

return 2;
}

File Test1.h:

#define typedef_packed_struct typedef _Packed struct
typedef unsigned int word32;
#define BITFIELDS_FROM_LSB

typedef_packed_struct
{
#ifdef BITFIELDS_FROM_LSB
//Start from the LSB
word32 A:5;
word32 B:6;
word32 C:5;
word32 D:5;
word32 E:3;
word32 F:8;
#elif BITFIELDS_FROM_MSB
//Start from the MSB
word32 F:8;
word32 E:3;
word32 D:5;
word32 C:5;
word32 B:6;
word32 A:5;
#endif
} A_Type;

typedef union
{
word32 AA;
A_Type A;
} A_Union_Type;

typedef_packed_struct
{
#ifdef BITFIELDS_FROM_LSB
//Start from the LSB
word32 G:5;
word32 H:6;
word32 I:5;
word32 J:5;
word32 K:3;
word32 L:8;
#elif BITFIELDS_FROM_MSB
//Start from the MSB
word32 M:8;
word32 N:3;
word32 O:5;
word32 P:5;
word32 Q:6;
word32 R:5;
#endif
} B_Type;

typedef union
{
word32 BB;
B_Type B;
} B_Union_Type;


When typing foo.A.
It will show A, B, C.. , R

Thanks,
feline Posted - Mar 21 2006 : 5:37:04 PM
i am now confused. i placed the code from your first post into a cpp file in VS2003 with VA 1440
VA did not know that "A_Type" was a type, which makes sense since it would have to resolve the #define to discover that this is a structure.

so then i tried the code:

typedef unsigned int word32;
#define BITFIELDS_FROM_LSB

typedef struct
{
#ifdef BITFIELDS_FROM_LSB
    //Start from the LSB
    word32 A:5;
    word32 B:6;
    word32 C:5;
    word32 D:5;
    word32 E:3;
    word32 F:8;
#elif BITFIELDS_FROM_MSB
    //Start from the MSB
    word32 F:8;
    word32 E:3;
    word32 D:5;
    word32 C:5;
    word32 B:6;
    word32 A:5;
#endif
} A_Type;

typedef union
{
    word32 AA;
    A_Type A;
} A_Union_Type;



static int getCounter()
{
    A_Union_Type foo;
    foo.A.|
    return 2;
}


i had tried:

typedef _Packed struct { ... }

but this would not compile until i removed the "_Packed". when i type the dot i get a list of just 6 items, A -> F. what do you mean by "all the fields in the project"?
hezi Posted - Mar 15 2006 : 02:07:19 AM
Hi,

Thanks for your answer.
I understand that VA doesn't know which defines are active and which are not. Still, I would expect it to show only the fields of the structure (it can show all the fields of the structure regardless to if they are under the define that is active) for example if the structure is as follows:
typedef_packed_struct
{
#ifdef A
word32 A:5;
word32 B:6;
word32 C:5;
word32 D:5;
word32 E:3;
word32 F:8;
#else
word32 G:8;
word32 H:3;
word32 I:5;
word32 J:5;
word32 K:6;
word32 L:5;
#endif
} ABC_Type;

I would expect that when using this struct VA will show me only the fields A, B, C, D, E, F, G, H, I, J, K, and L and not all the fields that I have in the project (and I hava a lot).
feline Posted - Mar 13 2006 : 3:52:44 PM
you may have some luck with:

VA Options -> text editor -> listboxes -> get content from default intellisense

VA does not know which #define's are active and which are not, so it parses all code, regardless. one reason for this is so that you still get help with your code inside #ifdef _DEBUG when the IDE is set to compile in release mode.
hezi Posted - Mar 12 2006 : 04:52:02 AM
I'm sorry, here is some more info:

IDE - Visual Studio 6
Programming language - C
VA X build 2006.03.07

Here is an example:

#define typedef_packed_struct typedef _Packed struct
typedef unsigned int word32;
#define BITFIELDS_FROM_LSB

typedef_packed_struct
{
#ifdef BITFIELDS_FROM_LSB
//Start from the LSB
word32 A:5;
word32 B:6;
word32 C:5;
word32 D:5;
word32 E:3;
word32 F:8;
#elif BITFIELDS_FROM_MSB
//Start from the MSB
word32 F:8;
word32 E:3;
word32 D:5;
word32 C:5;
word32 B:6;
word32 A:5;
#endif
} A_Type;

typedef union
{
word32 AA;
A_Type A;
} A_Union_Type;

When using:

A_Union_Type a;

and then a.A.

It shows all the structures fields in the project and not just A, B, C, D, E, and F.

Thanks in advance,
support Posted - Mar 09 2006 : 10:42:00 AM
We need some more info to debug your problem.

What IDE do you have?
What programming language?
What build of VA X?

Does the problem occur with all structures and unions? If not, what is common with those with the problem?

Do you have "Get contents from default Intellense" or "Guess contents if unknown" enabled in the "Text Editor|Listboxes" node of the VA X options dialog?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000