Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 union parsing problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

barto
Junior Member

Germany
19 Posts

Posted - Jan 10 2008 :  07:01:35 AM  Show Profile  Reply with Quote
Hi, I'm currently evaluating VAX

VA_X.dll file version 10.4.1624.0  built 2007.12.07
DevEnv.exe version 8.0.50727.762
msenv.dll version 8.0.50727.762
Font: Courier New 13(Pixels)
Comctl32.dll version 6.0.2900.2982
Windows XP 5.1 Build 2600 Service Pack 2
2 processors

Platform: Win32
Stable Includes:
C:\\Code\\MSVS8\\VC\\include;
C:\\Code\\MSVS8\\VC\\atlmfc\\include;
C:\\Code\\PSDK8\\Include;
C:\\Code\\DXSDK\\Include;
C:\\Code\\MSVS8\\SDK\\v2.0\\include;

Other Includes:

Stable Source Directories:
C:\\Code\\MSVS8\\VC\\atlmfc\\src\\mfc;
C:\\Code\\MSVS8\\VC\\atlmfc\\src\\mfcm;
C:\\Code\\MSVS8\\VC\\atlmfc\\src\\atl;
C:\\Code\\MSVS8\\VC\\crt\\src;


I'm having trouble with VAX's intellisense on some (not so complex) classes with unions and anonymous structs:


class CMatrix  
{
public:
	bool Equals(const CMatrix& m1);
	CMatrix& Transpose();
	CMatrix& Invert() { Invert(4); return *this; }
	CMatrix& Invert3() { Invert(3); return *this; }
	CMatrix& LookAt(const CVector& vEye, const CVector& vAt, const CVector& vUp);
	CMatrix& Multiply(const CMatrix& m1, const CMatrix& m2);
	CMatrix& MultiplyRev(const CMatrix& m1, const CMatrix& m2) { return Multiply(m2, m1); }
	CMatrix& Identity();
	CMatrix& RotationZ(float a);
	CMatrix& RotationY(float a);
	CMatrix& RotationX(float a);
	CMatrix& Rotation(const CVector& v, float phi);
	CMatrix& Translation(float x, float y, float z);
	CMatrix& Translation(const CVector& v) { return Translation(v.x, v.y, v.z); }
	CMatrix& Scaling(float sx, float sy, float sz);
//	CMatrix();
	CMatrix& FromGL(GLenum mode);
	CMatrix& Ortho3();
	CMatrix& FromQuaternion(const CQuaternion& quat);
	void ToGL();
	void MultGL();

	void Dump();

	bool operator== (const CMatrix& m2) const;
	bool operator!= (const CMatrix& m2) const;


	union {
		struct {
			float _11, _12, _13, _14;
			float _21, _22, _23, _24;
			float _31, _32, _33, _34;
			float _41, _42, _43, _44;

		};
		float data[16];
		float m[4][4];
	};

protected:
	void Invert(int size);
};


the only data member VAX IntelliSense is showing for CMatrix is "m". Also, the realtime "spellchecker" is underlining where I access ._11, etc...


class CVector  
{
public:
	// Constructors
	CVector() {}
	CVector(float ax, float ay, float az) { x = ax; y = ay; z = az; }
	CVector(const CVector& v) { x = v.x; y = v.y; z = v.z; }
	CVector(float* v) { x = v[0]; y = v[1]; z = v[2]; }

	// Operators
	CVector& operator=  (const CVector& v);
	CVector& operator+= (const CVector& v);
	CVector& operator-= (const CVector& v);
	CVector& operator*= (const CVector& v);
	CVector& operator*= (float f);
	CVector& operator/= (float f);
	CVector& operator*= (const CMatrix& m);

	bool operator== (const CVector& v2) const;
	bool operator!= (const CVector& v2) const;
	bool operator<= (const CVector& v2) const;
	bool operator>= (const CVector& v2) const;

	bool Normalize();
	float MagnitudeSquared();
	float Magnitude();

	static float Dot(const CVector& v1, const CVector& v2);
	void Cross(const CVector& v1, const CVector& v2);
	float Transform(const CVector& v, const CMatrix& m);
	float Transform3(const CVector& v, const CMatrix& m);

	CVector& EulerFromMatrix(const CMatrix& m);

	void Dump() const;

	CString FormatNitro() const;

	union {
		struct {
			float x, y, z;
		};
		float c[3];
	};
};


the only data member VAX IntelliSense is showing for CVector is "c".

I already searched the forum but didn't really find a solution for this behaviour.

feline
Whole Tomato Software

United Kingdom
18941 Posts

Posted - Jan 10 2008 :  08:56:08 AM  Show Profile  Reply with Quote
I am seeing the same thing, thank you for the clear description. Currently our parser is confused by unnamed structures and unions inside another structure / union:

case=4514


To work around the problem for now you can simply add an option name to the inner struct, so a simplified version of CMatrix becomes:

class CMatrix  
{
public:
	union {
		struct ANONYMOUS_STRUCT {
			float _11, _12, _13, _14;
			float _21, _22, _23, _24;
			float _31, _32, _33, _34;
			float _41, _42, _43, _44;
		};
		float data[16];
		float m[4][4];
	};

protected:
	void Invert(int size);
};

static void testClassHere()
{
	CMatrix foo;
	foo;
}


This has the side effect of adding "ANONYMOUS_STRUCT" to the list of suggested members, but the missing members are now listed correctly for me. The same fix should work for your CVector class as well.

zen is the art of being at one with the two'ness
Go to Top of Page

barto
Junior Member

Germany
19 Posts

Posted - Jan 11 2008 :  06:02:12 AM  Show Profile  Reply with Quote
unfortunately if I add ANONYMOUS_STRUCT then I can no longer access vec.x, the compiler craps out... :(
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18941 Posts

Posted - Jan 11 2008 :  10:14:04 AM  Show Profile  Reply with Quote
*ah* I am seeing the same problem. This, slightly evil, work around fixes both problems for me. Using VS2005 and VA 1624 I am seeing the members suggested, and the code compiles:

#ifdef CHEAT_TO_HELP_VA
#define ANONYMOUS_STRUCT ANONYMOUS_STRUCT
#else
#define ANONYMOUS_STRUCT
#endif

class CVector  
{
public:
	CVector() {}
	static float Dot(const CVector& v1, const CVector& v2);

	union {
		struct ANONYMOUS_STRUCT {
			float x, y, z;
		};
		float c[3];
	};
};

static void testVectorMembers()
{
	CVector foo;
	foo.x = 1.1;
	foo.z = 2.2;
}

zen is the art of being at one with the two'ness
Go to Top of Page

barto
Junior Member

Germany
19 Posts

Posted - Jan 17 2008 :  07:16:32 AM  Show Profile  Reply with Quote
Hi,
thanks for the workaround, but actually I have code like this a couple of dozen times in my sources and don't really want to add that workaround to all the instances.
What's the ETA of an updated VAX version with this fix?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18941 Posts

Posted - Jan 17 2008 :  10:28:39 AM  Show Profile  Reply with Quote
Unfortunately I do not have an estimate for when this will be fixed, but I have increased the priority of the bug for you, which should help a bit.

zen is the art of being at one with the two'ness
Go to Top of Page

much
Junior Member

12 Posts

Posted - Mar 03 2008 :  10:54:33 AM  Show Profile  Reply with Quote
We're seeing this frequently. We use anonymous unions quite heavily in our (large) code base and it's not practical to hack in any workarounds for VAX compatibility. Is there an ETA on a fix for this yet? It seems to have been broken for about a year now, judging by this thread:

http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6125
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18941 Posts

Posted - Mar 03 2008 :  2:22:25 PM  Show Profile  Reply with Quote
This is listed as fixed internally, and the fix should turn up in the next build of VA.

zen is the art of being at one with the two'ness
Go to Top of Page

briancollins
Senior Member

United Kingdom
39 Posts

Posted - Apr 10 2008 :  03:12:00 AM  Show Profile  Reply with Quote
Did this get fixed? It isn't listed as far as I can see. :-(

Brian
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18941 Posts

Posted - Apr 10 2008 :  09:42:37 AM  Show Profile  Reply with Quote
This is partly fixed in VA 1632, but not fully fixed, which is why it was not announced. Hopefully this will be fully fixed in the next build of VA.

You may see some improvements in VA 1632:

http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=7404

zen is the art of being at one with the two'ness
Go to Top of Page

briancollins
Senior Member

United Kingdom
39 Posts

Posted - Apr 10 2008 :  10:13:03 AM  Show Profile  Reply with Quote
Thanks for the clarification

Brian
Go to Top of Page

support
Whole Tomato Software

5566 Posts

Posted - Apr 24 2008 :  12:25:26 AM  Show Profile  Reply with Quote
case=4514 is fixed in build 1635
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000