Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 union parsing problem

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
barto Posted - Jan 10 2008 : 07:01:35 AM
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.
11   L A T E S T    R E P L I E S    (Newest First)
support Posted - Apr 24 2008 : 12:25:26 AM
case=4514 is fixed in build 1635
briancollins Posted - Apr 10 2008 : 10:13:03 AM
Thanks for the clarification

Brian
feline Posted - Apr 10 2008 : 09:42:37 AM
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
briancollins Posted - Apr 10 2008 : 03:12:00 AM
Did this get fixed? It isn't listed as far as I can see. :-(

Brian
feline Posted - Mar 03 2008 : 2:22:25 PM
This is listed as fixed internally, and the fix should turn up in the next build of VA.
much Posted - Mar 03 2008 : 10:54:33 AM
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
feline Posted - Jan 17 2008 : 10:28:39 AM
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.
barto Posted - Jan 17 2008 : 07:16:32 AM
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?
feline Posted - Jan 11 2008 : 10:14:04 AM
*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;
}
barto Posted - Jan 11 2008 : 06:02:12 AM
unfortunately if I add ANONYMOUS_STRUCT then I can no longer access vec.x, the compiler craps out... :(
feline Posted - Jan 10 2008 : 08:56:08 AM
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.

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