Sign in to follow this  
Guest HC001ST - Stick

gauge.h HEADER union.

Recommended Posts

Ok, I'm doing my homework and studying the header (with Arne's improvements), and I see this part below:

#define ELEMENT_INFO											ELEMENT_TYPE_ENUM				element_type;		   	ID								resource_id;				PIXPOINT						position;					PIXPOINT						previous_position;	  	PIXPOINT						ofs;						PGAUGEHDR						gauge_header;		   	struct ELEMENT_HEADER			*previous_element;	  	struct ELEMENT_HEADER			**next_element;		 	PFAILURE_RECORD					failure_systems;			FLAGS							image_flags;				FLAGS							aircraft_special_instrumentation;	FLAGS							reserved;typedef struct ELEMENT_HEADER{		ELEMENT_INFO}ELEMENT_HEADER;#define HEADER union		{								struct						{								ELEMENT_INFO			};							ELEMENT_HEADER header;	}

It seems this HEADER macro is redundant. Any thoughts as to why, or do I need to review my cpp preprocessor tokenization again? =)

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I finally understand what MS was doing here. Basically, they were trying to create a new Type within the limits of C.This macro gives them the same functionality as a C++ anonymous union, which isn't available in C.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this