declare structure w/ mix alignment in project..

N

nm

I create new prj w/ MSVC++ 6. This prj have compiler's option : Default
struct alignment == 8 /Zp8

so i don't know how do i declare myStruct w/ no alignment (align(1)).

i declared
__declspec(align(1)) struct tagMAB_CODE_HEADER{
uint8 iID;
uint8 iSection[8];
uint16 iLength;
uint8 iCmdID;
uint8 iResponse;
} ;

typedef struct tagMAB_CODE_HEADER MAB_CODE_HEADER;

but it's not work ?

nm.
 
V

Victor Bazarov

nm said:
I create new prj w/ MSVC++ 6. This prj have compiler's option :
Default struct alignment == 8 /Zp8

so i don't know how do i declare myStruct w/ no alignment (align(1)).

i declared
__declspec(align(1)) struct tagMAB_CODE_HEADER{
uint8 iID;
uint8 iSection[8];
uint16 iLength;
uint8 iCmdID;
uint8 iResponse;
} ;

typedef struct tagMAB_CODE_HEADER MAB_CODE_HEADER;

but it's not work ?

Is that a question? Alignment is platform-specific and things like
'__declspec' are compiler-specific. As such they are OT here. Please
ask in 'microsoft.public.vc.language'.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top