salem let me explain, I went to delete the FIRST thread I made on byte alignment after I realized I posted two threads on the same topic (I forgot I made the first). Then, I couldn't find the most recent one I made so I assume you deleted it, now none exist but I still need to understand what this means.

Anyway I know that PACK_STRUCT expands to nothing, but I don't know what the rest of those '#' directives mean, and I would like someone to tell me. I don't know what the pack/push __attribute__((packed)) lines mean. When I just include the structures without the defines the application doesn't work properly.


Code:
#ifdef _MSC_VER
#	pragma pack( push, packing )
#	pragma pack( 1 )
#	define PACK_STRUCT
#elif defined( __GNUC__ )
#	define PACK_STRUCT	__attribute__((packed))
#else
#	error you must byte-align these structures with the appropriate compiler directives
#endif

typedef unsigned char byte;
typedef unsigned short word;

// File header
struct MS3DHeader
{
	char m_ID[10];
	int m_version;
} PACK_STRUCT;
....//MORE STRUCTS THAT DON'T NEED TO TAKE UP SPACE

// Default alignment
#ifdef _MSC_VER
#	pragma pack( pop, packing )
#endif

#undef PACK_STRUCT
yeah well salem don't beat me up plz